Skip to content

Commit 71ee949

Browse files
committed
Merge branch 'jp/prompt-clear-before-upstream-mark' into seen
Bash command line prompt (in contrib/) update. * jp/prompt-clear-before-upstream-mark: git-prompt: fix expansion of branch colour codes
2 parents 3cc562c + f76a3b8 commit 71ee949

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

contrib/completion/git-prompt.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,21 +556,21 @@ __git_ps1 ()
556556
fi
557557
fi
558558

559-
b=${b##refs/heads/}
560559
local z="${GIT_PS1_STATESEPARATOR-" "}"
561560

561+
b=${b##refs/heads/}
562+
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
563+
__git_ps1_branch_name=$b
564+
b="\${__git_ps1_branch_name}"
565+
fi
566+
562567
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
563568
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
564569
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
565570
__git_ps1_colorize_gitstring
566571
fi
567572
fi
568573

569-
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
570-
__git_ps1_branch_name=$b
571-
b="\${__git_ps1_branch_name}"
572-
fi
573-
574574
local f="$h$w$i$s$u$p"
575575
local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}"
576576

0 commit comments

Comments
 (0)