Commit 81004dfaba reverted the change
in 9b811fb625 when editing the merge
conflict from #2928.
This commit fixes that so that we don't make the same mistake again.
First seen in http://git.io/Cdaj5Q
Merged from #2906
The function `git_prompt_info` calls `git config` for its stdout output,
but doesn't handle the stderr output. This can lead to problems,
e.g. if the git config file is unreadable for some reason (permissions
etc).
This fixes the issue by simply ignoring the stderr output.
In this commit, the option only works for git but it should not be to hard for
someone who knows svn to so the same.
This commit is largely inspired by @yoavweiss, I only added an option to use
it.
If oh-my-zsh.hide-status is configured, the 'clean' code won't be
generated, and some themes might end up distorted. Let's generate the
'clean' code even when we don't want the show the dirty status.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: git.zsh
#, ignoring untracked files, which seems to be the primary cause for slowness
This patch makes git_prompt_status support three new status variables:
- ZSH_THEME_GIT_PROMPT_AHEAD
- ZSH_THEME_GIT_PROMPT_BEHIND
- ZSH_THEME_GIT_PROMPT_DIVERGED
With these extra variables it's easy to see (1) if you have commits in
your local branch that weren't pushed to the remote (AHEAD), (2) if
there are commits in the remote that you haven't merged/rebased yet
(BEHIND) or (3) if you have local unpushed commits AND the remote has
some commits you haven't merged yet (DIVERGED).
Refer to the first line displayed on `git status -b --porcelain`.
An example setup in a .zsh-theme file would be:
ZSH_THEME_GIT_PROMPT_AHEAD="↑"
ZSH_THEME_GIT_PROMPT_BEHIND="↓"
ZSH_THEME_GIT_PROMPT_DIVERGED="↕"
For certain git repositories, this slows down usage
of the shell horifically.
This option can be set with
git config --add oh-my-zsh.hide-status 1
which will disable checking/showing the status notification
Changes method git_parse_ahead() on git.zsh lib file. Before this
change it checked directly against origin/master branch. Now it
uses $(current_branch) to check for not pushed changes against
the current remote branch.
Modifies the Git lib file (lib/git.zsh), adding three new prompt
methods:
- git_prompt_ahead(): Shows the content of the custom var
$ZSH_THEME_GIT_PROMPT_AHEAD if the local repository has
commits ahead from the remote origin repository
- git_prompt_short_sha(): Shows last commit SHA hash in short
mode wrapped between the content of the custom vars
$ZSH_THEME_GIT_PROMPT_SHA_BEFORE and
$ZSH_THEME_GIT_PROMPT_SHA_AFTER
- git_prompt_long_sha(): Shows last commit SHA hash in long
mode wrapped between the content of the custom vars
$ZSH_THEME_GIT_PROMPT_SHA_BEFORE and
$ZSH_THEME_GIT_PROMPT_SHA_AFTER