From e137284689ca513e5c3d9225da720c9eb32846a3 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 21 Apr 2016 09:03:37 +0200 Subject: prüft jetzt auch remote-Status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash-git-prompt | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2