From 265655877465b7b4e7c63df4b2f252bb5296612a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Tue, 14 Jul 2020 00:54:59 +0200 Subject: [PATCH] Merged detached head into master --- PS1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PS1 b/PS1 index bb735a1..623aab8 100644 --- a/PS1 +++ b/PS1 @@ -1,11 +1,11 @@ # /etc/profile.d/PS1.sh: executed by Bourne-compatible login shells. parse_git_branch() { - local LBRANCH="$(git branch 2>/dev/null | sed -ne 's/* \(.*\)/ \1/p'|tr -d \"[:blank:]\")" - local RBRANCH="$( git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null |tr -d \"[:blank:]\" )" + local LBRANCH="$(git branch 2>/dev/null | sed -ne 's/* \(.*\)/ \1/p'|sed -e 's/^[[:blank:]]*//;s/[[:blank:]]*$//')" + local RBRANCH="$( git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null |sed -e 's/^[[:blank:]]*//' )" [ -z "${RBRANCH-x}" ] && unset RBRANCH - local BRANCH="$LBRANCH ${RBRANCH+->} $RBRANCH" - [ -z "${LBRANCH+x}" -o -z "${RBRANCH}" ] || echo "($BRANCH)" + local BRANCH="${LBRANCH}${RBRANCH+ -> }${RBRANCH}" + [ -z "${LBRANCH+x}" ] || echo "($BRANCH)" } set_label() {