summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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