{"thread":{"id":"29672","subject":"[PATCH] completion: Allow dash as the first character for __git_ps1","startedAt":"2012-02-20T12:17:53Z","lastAt":"2012-02-21T20:49:24Z","messageCount":3,"participants":["Christian Hammerl","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"184986","messageId":"1329740273-5580-1-git-send-email-info@christian-hammerl.de","threadId":"29672","inReplyTo":null,"subject":"[PATCH] completion: Allow dash as the first character for __git_ps1","fromName":"Christian Hammerl","fromEmail":"info@christian-hammerl.de","sentAt":"2012-02-20T12:17:53Z","receivedAt":"2012-02-20T12:17:53Z","isPatch":true,"sender":{"key":"info@christian-hammerl.de","avatar":"https://avatars.githubusercontent.com/u/838666?v=4"},"body":"If the argument for `__git_ps1` begins with a dash, `printf` tries to\ninterpret it as an option which results in an error message.\nThe problem is solved by adding '--' before the argument to tell\n`printf` to not interpret the following argument as an option.\nAdding '--' directly to the argument does not help because the argument\nis enclosed by double quotes.\n\nSigned-off-by: Christian Hammerl <info@christian-hammerl.de>\n---\n contrib/completion/git-completion.bash |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 91c7acb..61ff152 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -313,7 +313,7 @@ __git_ps1 ()\n \t\tfi\n \n \t\tlocal f=\"$w$i$s$u\"\n-\t\tprintf \"${1:- (%s)}\" \"$c${b##refs/heads/}${f:+ $f}$r$p\"\n+\t\tprintf -- \"${1:- (%s)}\" \"$c${b##refs/heads/}${f:+ $f}$r$p\"\n \tfi\n }\n \n-- \n1.7.9\n"},{"id":"185098","messageId":"7vty2jgbsh.fsf@alter.siamese.dyndns.org","threadId":"29672","inReplyTo":"1329740273-5580-1-git-send-email-info@christian-hammerl.de","subject":"Re: [PATCH] completion: Allow dash as the first character for __git_ps1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-21T20:40:46Z","receivedAt":"2012-02-21T20:40:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Hammerl <info@christian-hammerl.de> writes:\n\n> If the argument for `__git_ps1` begins with a dash, `printf` tries to\n> interpret it as an option which results in an error message.\n> The problem is solved by adding '--' before the argument to tell\n> `printf` to not interpret the following argument as an option.\n> Adding '--' directly to the argument does not help because the argument\n> is enclosed by double quotes.\n>\n> Signed-off-by: Christian Hammerl <info@christian-hammerl.de>\n> ---\n>  contrib/completion/git-completion.bash |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 91c7acb..61ff152 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -313,7 +313,7 @@ __git_ps1 ()\n>  \t\tfi\n>  \n>  \t\tlocal f=\"$w$i$s$u\"\n> -\t\tprintf \"${1:- (%s)}\" \"$c${b##refs/heads/}${f:+ $f}$r$p\"\n> +\t\tprintf -- \"${1:- (%s)}\" \"$c${b##refs/heads/}${f:+ $f}$r$p\"\n>  \tfi\n>  }\n\nHmm, so you may be doing something like PS1='\\W$(__git_ps1 \"-%s\")'?\nOK, and thanks.  \n"},{"id":"185101","messageId":"80e5224c-66f4-4bdf-9e0e-9aeb7f4f319d@email.android.com","threadId":"29672","inReplyTo":"7vty2jgbsh.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] completion: Allow dash as the first character for __git_ps1","fromName":"Christian Hammerl","fromEmail":"info@christian-hammerl.de","sentAt":"2012-02-21T20:49:24Z","receivedAt":"2012-02-21T20:49:24Z","isPatch":true,"sender":{"key":"info@christian-hammerl.de","avatar":"https://avatars.githubusercontent.com/u/838666?v=4"},"body":"Yes, kind of.\n\nIt is more like PS1='\\W$(__git_ps1 \"-[ %s ]\")'. And i am fixing it after each update on my machine. ;-)\n\n\n\nJunio C Hamano <gitster@pobox.com> schrieb:\n\n>Christian Hammerl <info@christian-hammerl.de> writes:\n>\n>> If the argument for `__git_ps1` begins with a dash, `printf` tries to\n>> interpret it as an option which results in an error message.\n>> The problem is solved by adding '--' before the argument to tell\n>> `printf` to not interpret the following argument as an option.\n>> Adding '--' directly to the argument does not help because the\n>argument\n>> is enclosed by double quotes.\n>>\n>> Signed-off-by: Christian Hammerl <info@christian-hammerl.de>\n>> ---\n>>  contrib/completion/git-completion.bash |    2 +-\n>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/contrib/completion/git-completion.bash\n>b/contrib/completion/git-completion.bash\n>> index 91c7acb..61ff152 100755\n>> --- a/contrib/completion/git-completion.bash\n>> +++ b/contrib/completion/git-completion.bash\n>> @@ -313,7 +313,7 @@ __git_ps1 ()\n>>  \t\tfi\n>>  \n>>  \t\tlocal f=\"$w$i$s$u\"\n>> -\t\tprintf \"${1:- (%s)}\" \"$c${b##refs/heads/}${f:+ $f}$r$p\"\n>> +\t\tprintf -- \"${1:- (%s)}\" \"$c${b##refs/heads/}${f:+ $f}$r$p\"\n>>  \tfi\n>>  }\n>\n>Hmm, so you may be doing something like PS1='\\W$(__git_ps1 \"-%s\")'?\n>OK, and thanks.  \n\n-- \nDiese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.\n"}]}