Skip to content

Commit 4cc4738

Browse files
spearcegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c18d5d8 commit 4cc4738

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

contrib/completion/git-completion.bash

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,8 @@ __git_ps1 ()
163163
fi
164164
fi
165165

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"
171168
fi
172169
}
173170

0 commit comments

Comments
 (0)