summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChristian Hammerl <info@christian-hammerl.de>2012-02-20 12:17:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-21 20:38:07 (GMT)
commitf24a595f72e52b3519067cfb0f05652aabf1e144 (patch)
treee005ae4d1d364f0407c7f9b407636e913f02e674 /contrib
parent233054d114b0d68cf58d18f4c7ddd7723c08b24f (diff)
downloadgit-f24a595f72e52b3519067cfb0f05652aabf1e144.zip
git-f24a595f72e52b3519067cfb0f05652aabf1e144.tar.gz
git-f24a595f72e52b3519067cfb0f05652aabf1e144.tar.bz2
completion: Allow dash as the first character for __git_ps1
If the argument for `__git_ps1` begins with a dash, `printf` tries to interpret it as an option which results in an error message. The problem is solved by adding '--' before the argument to tell `printf` to not interpret the following argument as an option. Adding '--' directly to the argument does not help because the argument is enclosed by double quotes. Signed-off-by: Christian Hammerl <info@christian-hammerl.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 91c7acb..61ff152 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -313,7 +313,7 @@ __git_ps1 ()
fi
local f="$w$i$s$u"
- printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
+ printf -- "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
fi
}