fix branch
This commit is contained in:
parent
d251a9d34e
commit
0a8cffb3b9
1 changed files with 5 additions and 3 deletions
8
PS1
8
PS1
|
@ -1,9 +1,11 @@
|
||||||
# /etc/profile.d/PS1.sh: executed by Bourne-compatible login shells.
|
# /etc/profile.d/PS1.sh: executed by Bourne-compatible login shells.
|
||||||
|
|
||||||
parse_git_branch() {
|
parse_git_branch() {
|
||||||
local BRANCH=$(git branch 2>/dev/null | sed -ne 's/* \(.*\)/ (\1/p')
|
local LBRANCH="$(git branch 2>/dev/null | sed -ne 's/* \(.*\)/ \1/p'|tr -d \"[:blank:]\")"
|
||||||
BRANCH="$BRANCH ${BRANCH-->} $( git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null ) )"
|
local RBRANCH="$( git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null |tr -d \"[:blank:]\" )"
|
||||||
echo $BRANCH
|
[ -z "${RBRANCH-x}" ] && unset RBRANCH
|
||||||
|
local BRANCH="$LBRANCH ${RBRANCH+->} $RBRANCH"
|
||||||
|
[ -z "${LBRANCH+x}" -o -z "${RBRANCH}" ] || echo "($BRANCH)"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_label() {
|
set_label() {
|
||||||
|
|
Loading…
Reference in a new issue