summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-05-04 10:42:05 +0200
committerErich Eckner <git@eckner.net>2016-05-04 10:42:05 +0200
commitba496fe97a56cefb5d0129215c902995e9862dd5 (patch)
treeb0d5e4714026454e2bed5165df12c5d0024240c8
parente621dbbff631d889858dbed8fef95c515055812c (diff)
downloadbash-git-prompt-ba496fe97a56cefb5d0129215c902995e9862dd5.tar.xz
bugfix: remote Status korrekt(er), verwendet jetzt plumbing-Befehle
-rwxr-xr-xbash-git-prompt28
1 files changed, 9 insertions, 19 deletions
diff --git a/bash-git-prompt b/bash-git-prompt
index b61d606..bc3c3d2 100755
--- a/bash-git-prompt
+++ b/bash-git-prompt
@@ -1,7 +1,5 @@
#!/bin/bash
-set -o pipefail
-
[[ "$TERM" = *color ]] && mitFarbe=true || mitFarbe=false
[ -z "$PS1Start" ] && [ -z "$PS1Ende" ] &&
@@ -16,28 +14,20 @@ set -o pipefail
PS1="$PS1Start"
-if branches="$(git branch -a --no-color 2>/dev/null | sed 's|^\s*||')" && status=$(git status --porcelain 2> /dev/null)
+if status=$(git status --porcelain 2> /dev/null)
then
PS1="$PS1 "
- branch="$(
- echo "${branches}" | \
- grep '^\*' | \
- sed 's|^\*\s*||'
- )"
+ branch="$(git symbolic-ref HEAD 2> /dev/null | sed "s|^.*/||")"
echo "$status" | grep -q "^.\S" && wtClean=false || wtClean=true
echo "$status" | grep -q "^\S" && idxClean=false || idxClean=true
- remClean=true
- for remBranch in \
- $(
- echo "${branches}" | \
- grep '^\s*remotes/[^/]\+/'"${branch}" | \
- sed 's|^\s*\(remotes/[^/]\+/'"${branch}"'\)/.*$|\1|'
- )
- do
- [ "$(git describe --always --abbrev=0 "HEAD")" == "$(git describe --always --abbrev=0 "${remBranch}")" ] \
- || remClean=false
- done
+ [ $(git show-ref HEAD "${branch}" --head -s | \
+ uniq | \
+ wc -l
+ ) -eq 1 ] && \
+ remClean=true || \
+ remClean=false
+
if $mitFarbe
then
if ! $wtClean