Modify git_prompt_info to _not_ check git repository status when configuration option is specified and does not match current hostname.

This commit is contained in:
Adam Coddington 2013-02-14 17:31:13 -08:00
commit 848dcba5f0

View file

@ -1,8 +1,10 @@
# get the name of the branch we are on
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(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.show-branch-on-only)" == "$(hostname)" || -z "$(git config --get oh-my-zsh.show-branch-on-only)" ]]; then
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
ref=$(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
}