Skip to content

Commit

Permalink
adding a check for git config option to disable git_prompt_info() on …
Browse files Browse the repository at this point in the history
…a per repo basis
  • Loading branch information
Michael Orr committed Nov 20, 2013
1 parent 9f5a895 commit fbd479b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/git.zsh
@@ -1,8 +1,10 @@
# get the name of the branch we are on
function git_prompt_info() {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}


Expand Down

1 comment on commit fbd479b

@javache
Copy link

@javache javache commented on fbd479b Dec 5, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the same option parse_git_dirty was using :(

My use-case: checking if my huge repo is dirty on every prompt is very slow, so I disabled this using oh-my-zsh.hide-status. I still want to see the current branch I'm on (which is fast).

Could you add a second option oh-my-zsh.hide-dirty?

Please sign in to comment.