summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbash-git-prompt21
1 files changed, 20 insertions, 1 deletions
diff --git a/bash-git-prompt b/bash-git-prompt
index 6a7a95a..85d1bd0 100755
--- a/bash-git-prompt
+++ b/bash-git-prompt
@@ -16,11 +16,24 @@ set -o pipefail
PS1="$PS1Start"
-if branch=$(git branch 2>/dev/null | grep '^\*' | sed "s|^\*\s*||") && status=$(git status --porcelain 2> /dev/null)
+if branches="$(git branch -a --no-color 2>/dev/null | sed 's|^\s*||')" && status=$(git status --porcelain 2> /dev/null)
then
PS1="$PS1 "
+ branch="$(
+ echo "${branches}" | \
+ grep '^\*' | \
+ sed 's|^\*\s*||'
+ )"
echo "$status" | grep -q "^.\S" && wtClean=false || wtClean=true
echo "$status" | grep -q "^\S" && idxClean=false || idxClean=true
+ remBranch="$(
+ echo "${branches}" | \
+ grep '^\s*remotes/[^/]\+/'"${branch}" | \
+ sed 's|^\s*\(remotes/[^/]\+/'"${branch}"'\)/.*$|\1|'
+ )"
+ [ -n "${remBranch}" ] && \
+ [ "$(git describe --always --abbrev=0 "HEAD")" == "$(git describe --always --abbrev=0 "${remBranch}")" ] && \
+ remClean=true || remClean=false
if $mitFarbe
then
if ! $wtClean
@@ -29,6 +42,9 @@ then
elif ! $idxClean
then
PS1="$PS1\[\033[01;33m\]"
+ elif ! $remClean
+ then
+ PS1="$PS1\[\033[01;34m\]"
else
PS1="$PS1\[\033[01;32m\]"
fi
@@ -44,6 +60,9 @@ then
elif ! $idxClean
then
PS1="$PS1+"
+ elif ! $remClean
+ then
+ PS1="$PS1^"
fi
fi
fi