For huge repos, status checking can take many seconds. It's pretty annoying to
have such delay on each prompt message inside such repo. agnoster uses
parse_git_drity which respect the oh-my-zsh.hide-dirty flag. Thus, we don't
perform an expensive check in this case. However, it doesn't solve the original
problem because we still have a delay because of check-for-changes. The line
should be executed only for dirty repos.
The PROMPT building method clashes with other themes and
plugins that modify the PROMPT variable.
Also reverted the $jobstates trick due to it not working
inside $PROMPT.
* agnoster: improve perf with use of $jobstates (zsh/parameter module)
This saves multiple fork/execs (for the subshell and wc) each
time the prompt is rendered
* agnoster: compute git repo_path only when in a git repo
this avoids needlessly invoking git twice every time we render the prompt
* agnoster: avoid subshell when rendering prompt
Rather than forking a subshell to print the prompt, construct it
incrementally by appending to $PROMPT.
v2: fix incorrect CURRENT_BG
v3: fix bzr and hg prompting
Thanks @mcornella for the help.
Plugin command-not-found on Arch Linux returns 0 if git or bzr is found in repos, hence outputting unwanted pkgfile output.
Checking if the commands exist first fixes all such issues.
the agnoster theme is now able to render basic information
if the user is currently residing inside a bazaar folder.
if so, it will render a green promt segment with "bzr" and
the current revision number in it. if there are untracked
files, the bar will be rendered in yellow. if there are
changes to already tracked files, a + character will be
printed.
Problem
On detached-refs, the git prompt is very slow because it uses a command
to output all refs, which takes 32s on the twitter internal git repo.
Solution
Use git-rev-parse instead of git-show-ref to only output the head ref.
Runtime drops to 0.03 seconds.
Note
Interestingly, git-rev-parse isn't slow without the --head arguement so
I'll probably be cooking up a patch for the git team to speed this up
eventually, but it's still pointless to sigpipe git as it walks the
filesystem.
agnoster theme was checking if the default virtualenv prompt was turned off and not showing its own... so there was no way to see which virtualenv was selected.
This reverts commit f09af57179.
It is far more aesthetically pleasing, and conveys the correct amount of information. The exact numeric status code is extremely rarely of use, and increases cognitive parsing burden on the user.
(cherry picked from commit 8f664edcaf55adcc540f0fe43d4205b66e4f9fb6)