summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-04-21 09:03:37 +0200
committerErich Eckner <git@eckner.net>2016-04-21 09:20:11 +0200
commite137284689ca513e5c3d9225da720c9eb32846a3 (patch)
tree34537753bfc6c4defd01ad10634ec294369960c6
parent3140309e829a5895fd64e4681e1ae2d251da6c45 (diff)
downloadbash-git-prompt-0.7.tar.xz
prüft jetzt auch remote-Statusv0.7
-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