From ba496fe97a56cefb5d0129215c902995e9862dd5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 4 May 2016 10:42:05 +0200 Subject: bugfix: remote Status korrekt(er), verwendet jetzt plumbing-Befehle --- bash-git-prompt | 28 +++++++++------------------- 1 file 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 -- cgit v1.2.3-54-g00ecf