From a550921e75be44ecb06a4acfa638ddebe99494d8 Mon Sep 17 00:00:00 2001 From: Martin Gondermann Date: Thu, 13 Aug 2015 19:45:50 +0200 Subject: [PATCH] Revert "Simplify branch name extraction" This reverts commit fff05011c08034ac9b6b68601b97397f6ed4c1c6. Fixes #146 --- gitstatus.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gitstatus.sh b/gitstatus.sh index d167e90..68d1a08 100755 --- a/gitstatus.sh +++ b/gitstatus.sh @@ -19,10 +19,13 @@ if [ -z "${__GIT_PROMPT_DIR}" ]; then __GIT_PROMPT_DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )" fi -branch=`git symbolic-ref HEAD --short` +gitsym=`git symbolic-ref HEAD` # if "fatal: Not a git repo .., then exit -case "$branch" in fatal*) exit 0 ;; esac +case "$gitsym" in fatal*) exit 0 ;; esac + +# the current branch is the tail end of the symbolic reference +branch="${gitsym##refs/heads/}" # get the basename after "refs/heads/" gitstatus=`git diff --name-status 2>&1`