@matheusbsbs / matheus-bagliano / commits / 4cc47382df
Fork 0

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 <roman.fietze@telemotive.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Dec 30, 2009 at 19:04 UTC 4cc47382dfc2a71257934042f6c009287e101cb3
1 file changed +2 -5
contrib/completion/git-completion.bash
+2 -5
@@ -163,11 +163,8 @@ __git_ps1 ()
163 fi
164 fi
165
166 - if [ -n "${1-}" ]; then
167 - printf "$1" "$c${b##refs/heads/}$w$i$s$u$r"
168 - else
169 - printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r"
170 - fi
166 + local f="$w$i$s$u"
167 + printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r"
168 fi
169 }
170