From: Shawn O. Pearce Date: Thu, 31 Dec 2009 03:04:38 +0000 (-0800) Subject: bash completion: add space between branch name and status flags X-Git-Tag: v1.7.0-rc0~134 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4cc47382dfc2a71257934042f6c009287e101cb3?hp=--cc bash completion: add space between branch name and status flags Improve the readability of the bash prompt by adding a space between the branch name and the status flags (dirty, stash, untracked). While we are cleaning up this section of code, the two cases for formatting the prompt are identical except for the format string, so make them the same. Suggested-by: Roman Fietze Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- 4cc47382dfc2a71257934042f6c009287e101cb3 diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c65462c9ed..3a6498c04b 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -163,11 +163,8 @@ __git_ps1 () fi fi - if [ -n "${1-}" ]; then - printf "$1" "$c${b##refs/heads/}$w$i$s$u$r" - else - printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r" - fi + local f="$w$i$s$u" + printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r" fi }