summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2011-08-12 12:17:12 (GMT)
committerSZEDER Gábor <szeder@ira.uka.de>2013-06-24 16:03:37 (GMT)
commit14d7649748265fe9fe991439ca6ae0c9db7a27ab (patch)
treea6e23e0e48212ae51fcfd9d3e6010ea478afcd3f /contrib/completion
parentdd0b72cbd9e64c782a31c6acfca2ba9cf2ffb266 (diff)
downloadgit-14d7649748265fe9fe991439ca6ae0c9db7a27ab.zip
git-14d7649748265fe9fe991439ca6ae0c9db7a27ab.tar.gz
git-14d7649748265fe9fe991439ca6ae0c9db7a27ab.tar.bz2
bash prompt: avoid command substitution when checking for untracked files
When enabled, the bash prompt can indicate the presence of untracked files with a '%' sign. __git_ps1() checks for untracked files by running the '$(git ls-files --others --exclude-standard)' command substitution, and displays the indicator when there is no output. Avoid this command substitution by additionally passing '--error-unmatch *', and checking the command's return value. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Diffstat (limited to 'contrib/completion')
-rw-r--r--contrib/completion/git-prompt.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index afa8670..5ea6a68 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -442,7 +442,7 @@ __git_ps1 ()
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
- [ -n "$(git ls-files --others --exclude-standard)" ]
+ git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
then
u="%${ZSH_VERSION+%}"
fi