From 848dcba5f07f0311709b882064ea480cdac6bb33 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Thu, 14 Feb 2013 17:31:13 -0800 Subject: [PATCH] Modify git_prompt_info to _not_ check git repository status when configuration option is specified and does not match current hostname. --- lib/git.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 3e14695bd..f7309218e 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -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 }