summaryrefslogtreecommitdiffstats
path: root/contrib/completion/git-completion.bash
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2009-12-31 04:04:38 +0100
committerJunio C Hamano <gitster@pobox.com>2009-12-31 08:29:12 +0100
commit4cc47382dfc2a71257934042f6c009287e101cb3 (patch)
treed76e60d975b5766e15bf5d8430e9f77087bc6881 /contrib/completion/git-completion.bash
parentAdd completion for git-svn mkdirs,reset,and gc (diff)
downloadgit-4cc47382dfc2a71257934042f6c009287e101cb3.tar.xz
git-4cc47382dfc2a71257934042f6c009287e101cb3.zip
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>
Diffstat (limited to '')
-rwxr-xr-xcontrib/completion/git-completion.bash7
1 files changed, 2 insertions, 5 deletions
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
}