From: martin f. krafft Date: Fri, 5 Feb 2010 02:06:13 +0000 (+0100) Subject: fix branch detection X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/f79a11b4675d6df98c663d9ab37daca38b1b209d?ds=inline;hp=--cc fix branch detection --- f79a11b4675d6df98c663d9ab37daca38b1b209d diff --git a/.zsh/zshrc/60_vcsprompt b/.zsh/zshrc/60_vcsprompt index 07ea293..f9649fb 100644 --- a/.zsh/zshrc/60_vcsprompt +++ b/.zsh/zshrc/60_vcsprompt @@ -26,9 +26,10 @@ __git_get_reporoot() __git_get_branch() { # return the name of the git branch we're on - local ref - ref=$(git --git-dir="$PWD" symbolic-ref -q HEAD 2>/dev/null \ - || git --git-dir="$PWD" name-rev --name-only HEAD 2>/dev/null) || return 1 + local ref gitdir + gitdir="$(git rev-parse --git-dir)" + ref=$(git --git-dir="$gitdir" symbolic-ref -q HEAD 2>/dev/null \ + || git --git-dir="$gitdir" name-rev --name-only HEAD 2>/dev/null) || return 1 echo "${ref#refs/heads/}" }