From 71bc81b14af956e7bcd958c12d5aaf56d474f9a4 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 13:54:50 -0700 Subject: [PATCH] Only calling git symbolic-ref HEAD when we are in a .git directory --- git.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/git.zsh b/git.zsh index b9a86173..567c2faa 100644 --- a/git.zsh +++ b/git.zsh @@ -1,9 +1,8 @@ # get the name of the branch we are on function git_prompt_info() { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - branch=${ref#refs/heads/} - if [[ -d .git ]]; then + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + branch=${ref#refs/heads/} CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])" else CURRENT_BRANCH=''