From f79a11b4675d6df98c663d9ab37daca38b1b209d Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Fri, 5 Feb 2010 03:06:13 +0100 Subject: [PATCH] fix branch detection --- .zsh/zshrc/60_vcsprompt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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/}" } -- 2.39.5