a26cb28de4d095d547d774a3b3258a76f17507c3

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Only calling git symbolic-ref HEAD when we are in a .git directory

Diff

 1diff --git a/git.zsh b/git.zsh
 2index b9a86173f28376872458e6daa39c51538910c52c..567c2faa263a8a09cf59186d37169c62cecfe3eb 100644
 3--- a/git.zsh
 4+++ b/git.zsh
 5@@ -1,9 +1,8 @@
 6 # get the name of the branch we are on
 7 function git_prompt_info() {
 8-  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
 9-  branch=${ref#refs/heads/}
10-
11   if [[ -d .git ]]; then
12+    ref=$(git symbolic-ref HEAD 2> /dev/null) || return
13+    branch=${ref#refs/heads/}
14     CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
15   else
16     CURRENT_BRANCH=''