git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: Allow dash as the first character for __git_ps1
@ 2012-02-20 12:17 Christian Hammerl
  2012-02-21 20:40 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Hammerl @ 2012-02-20 12:17 UTC (permalink / raw)
  To: git, gitster; +Cc: Christian Hammerl

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>
---
 contrib/completion/git-completion.bash |    2 +-
 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
 }
 
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-21 20:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 12:17 [PATCH] completion: Allow dash as the first character for __git_ps1 Christian Hammerl
2012-02-21 20:40 ` Junio C Hamano
2012-02-21 20:49   ` Christian Hammerl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).