Skip to content
Browse files

adding a check for git config option to disable git_prompt_info() on …

…a per repo basis
  • Loading branch information...
1 parent 9f5a895 commit fbd479b68e2c58068666f738a009ef7a1ca8abde @michaelorr michaelorr committed Nov 20, 2013
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/git.zsh
View
8 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
}

1 comment on commit fbd479b

@javache
javache commented on fbd479b Dec 5, 2013

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.
Something went wrong with that request. Please try again.