{"thread":{"id":"34371","subject":"[PATCH] prompt: do not double-discriminate detached HEAD","startedAt":"2013-07-07T12:52:45Z","lastAt":"2013-07-08T13:49:07Z","messageCount":6,"participants":["Ramkumar Ramachandra","John Szakmeister","Junio C Hamano","Kyle McKay","Eduardo R. D'Avila"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"222744","messageId":"1373201565-14030-1-git-send-email-artagnon@gmail.com","threadId":"34371","inReplyTo":null,"subject":"[PATCH] prompt: do not double-discriminate detached HEAD","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-07-07T12:52:45Z","receivedAt":"2013-07-07T12:52:45Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"When GIT_PS1_SHOWCOLORHINTS is turned on, there is no need to put a\ndetached HEAD within parenthesis: the color can be used to discriminate\nthe detached HEAD.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n For cuteness :)\n\n contrib/completion/git-prompt.sh | 5 ++++-\n t/t9903-bash-prompt.sh           | 2 +-\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex a81ef5a..37e66a2 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -372,7 +372,10 @@ __git_ps1 ()\n \t\t\t\tesac 2>/dev/null)\" ||\n \n \t\t\t\tb=\"$short_sha...\"\n-\t\t\t\tb=\"($b)\"\n+\t\t\t\t# if there is no color, use\n+\t\t\t\t# parenthesis to indicate that the\n+\t\t\t\t# HEAD is detached\n+\t\t\t\ttest -n \"${GIT_PS1_SHOWCOLORHINTS-}\" || b=\"($b)\"\n \t\t\tfi\n \t\tfi\n \tfi\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 3c3e4e8..c44b1a6 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -450,7 +450,7 @@ test_expect_success 'prompt - bash color pc mode - branch name' '\n '\n \n test_expect_success 'prompt - bash color pc mode - detached head' '\n-\tprintf \"BEFORE: (${c_red}(%s...)${c_clear}):AFTER\" $(git log -1 --format=\"%h\" b1^) >expected &&\n+\tprintf \"BEFORE: (${c_red}%s...${c_clear}):AFTER\" $(git log -1 --format=\"%h\" b1^) >expected &&\n \tgit checkout b1^ &&\n \ttest_when_finished \"git checkout master\" &&\n \t(\n-- \n1.8.3.2.737.gcbc076a.dirty\n"},{"id":"222746","messageId":"CAEBDL5UfHpR3GNeqbDf9X3Ya+Spcpx0Byq5MZPMMsE=a3y2jhg@mail.gmail.com","threadId":"34371","inReplyTo":"1373201565-14030-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH] prompt: do not double-discriminate detached HEAD","fromName":"John Szakmeister","fromEmail":"john@szakmeister.net","sentAt":"2013-07-07T13:35:29Z","receivedAt":"2013-07-07T13:35:29Z","isPatch":true,"sender":{"key":"john@szakmeister.net","avatar":"https://avatars.githubusercontent.com/u/448087?v=4"},"body":"On Sun, Jul 7, 2013 at 8:52 AM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n> When GIT_PS1_SHOWCOLORHINTS is turned on, there is no need to put a\n> detached HEAD within parenthesis: the color can be used to discriminate\n> the detached HEAD.\n>\n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n>  For cuteness :)\n\nPersonally, I'd rather see the parens kept.  Not everyone sees red\nvery well--I know several people who can't see it at all, and it keeps\nit consistent with non-colored output.\n\n-John\n"},{"id":"222756","messageId":"7vppuu45q8.fsf@alter.siamese.dyndns.org","threadId":"34371","inReplyTo":"CAEBDL5UfHpR3GNeqbDf9X3Ya+Spcpx0Byq5MZPMMsE=a3y2jhg@mail.gmail.com","subject":"Re: [PATCH] prompt: do not double-discriminate detached HEAD","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-07T17:53:03Z","receivedAt":"2013-07-07T17:53:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Szakmeister <john@szakmeister.net> writes:\n\n> On Sun, Jul 7, 2013 at 8:52 AM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n>> When GIT_PS1_SHOWCOLORHINTS is turned on, there is no need to put a\n>> detached HEAD within parenthesis: the color can be used to discriminate\n>> the detached HEAD.\n>>\n>> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n>> ---\n>>  For cuteness :)\n>\n> Personally, I'd rather see the parens kept.  Not everyone sees red\n> very well--I know several people who can't see it at all, and it keeps\n> it consistent with non-colored output.\n\n+1; I find red on many terminal emulators to be too dark to tell,\nespecially in a small font, from black myself.\n"},{"id":"222767","messageId":"D6C71A23-A3AE-49F3-9D3A-B92483E7D247@gmail.com","threadId":"34371","inReplyTo":"7vppuu45q8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] prompt: do not double-discriminate detached HEAD","fromName":"Kyle McKay","fromEmail":"mackyle@gmail.com","sentAt":"2013-07-07T18:32:02Z","receivedAt":"2013-07-07T18:32:02Z","isPatch":true,"sender":{"key":"mackyle@gmail.com","avatar":"https://avatars.githubusercontent.com/u/813346?v=4"},"body":"On Jul 7, 2013, at 10:53, Junio C Hamano wrote:\n> John Szakmeister <john@szakmeister.net> writes:\n>\n>> On Sun, Jul 7, 2013 at 8:52 AM, Ramkumar Ramachandra <artagnon@gmail.com \n>> > wrote:\n>>> When GIT_PS1_SHOWCOLORHINTS is turned on, there is no need to put a\n>>> detached HEAD within parenthesis: the color can be used to  \n>>> discriminate\n>>> the detached HEAD.\n>>>\n>>> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n>>> ---\n>>> For cuteness :)\n>>\n>> Personally, I'd rather see the parens kept.  Not everyone sees red\n>> very well--I know several people who can't see it at all, and it  \n>> keeps\n>> it consistent with non-colored output.\n>\n> +1; I find red on many terminal emulators to be too dark to tell,\n> especially in a small font, from black myself.\n\n+1; me too for the same reason.\n"},{"id":"222790","messageId":"CAOz-D1+DU=DziVOcoa1=vy-pt8AX8wnUPY38tksep4S7ngKLpA@mail.gmail.com","threadId":"34371","inReplyTo":"1373201565-14030-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH] prompt: do not double-discriminate detached HEAD","fromName":"Eduardo R. D'Avila","fromEmail":"erdavila@gmail.com","sentAt":"2013-07-08T01:12:50Z","receivedAt":"2013-07-08T01:12:50Z","isPatch":true,"sender":{"key":"erdavila@gmail.com","avatar":"https://avatars.githubusercontent.com/u/341488?v=4"},"body":"I think color in terminals should be used to highlight and make it easier to see\ntextual information, not to replace them. So I would keep the parenthesis.\n\n> +                               test -n \"${GIT_PS1_SHOWCOLORHINTS-}\" || b=\"($b)\"\n\nAlso, the proposed change has a side-effect because color is not possible in\nnon-pc mode, even if GIT_PS1_SHOWCOLORHINTS is defined. (Non-pc mode\nwith GIT_PS1_SHOWCOLORHINTS defined would make the detached HEAD not be\nshown neither in red nor within parenthesis).\n\nRegards,\n\nEduardo R. D'Avila\n"},{"id":"222826","messageId":"CALkWK0nB3MBw0xKx29BH1_0Yq7eF61Jx7ANP5tyadezkmr35sw@mail.gmail.com","threadId":"34371","inReplyTo":"7vppuu45q8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] prompt: do not double-discriminate detached HEAD","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-07-08T13:49:07Z","receivedAt":"2013-07-08T13:49:07Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Junio C Hamano wrote:\n> +1; I find red on many terminal emulators to be too dark to tell,\n> especially in a small font, from black myself.\n\nIt's a matter of taste anyway.  I hope everyone's not going colorblind\nfrom writing too much C89 and Bourne shell ;)\n\nEduardo R. D'Avila wrote:\n> I think color in terminals should be used to highlight and make it easier to see\n> textual information, not to replace them. So I would keep the parenthesis.\n\nI largely agree, but there are a few exceptions.  Most notably, have\nyou noticed how, in addition to font-locking, scheme-mode replaces\nlambda with λ?\n"}]}