{"thread":{"id":"9657","subject":"[PATCH] When nothing to git-commit, honor the git-status color setting.","startedAt":"2007-08-26T18:35:26Z","lastAt":"2007-08-27T16:15:17Z","messageCount":5,"participants":["Brian Hetro","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"51579","messageId":"20070826183526.GA16359@ruiner","threadId":"9657","inReplyTo":null,"subject":"[PATCH] When nothing to git-commit, honor the git-status color setting.","fromName":"Brian Hetro","fromEmail":"whee@smaertness.net","sentAt":"2007-08-26T18:35:26Z","receivedAt":"2007-08-26T18:35:26Z","isPatch":true,"sender":{"key":"whee@smaertness.net","avatar":"https://gravatar.com/avatar/1d20c40734a674e76a0a58c6d122ef493291db306d613a40653a035084d557b9?d=mp&s=160"},"body":"Instead of disabling color all of the time during a git-commit, allow\nthe user's config preference in the situation where there is nothing\nto commit.  In this situation, the status is printed to the terminal\nand not sent to COMMIT_EDITMSG, so honoring the status color setting\nis expected.\n\nSigned-off-by: Brian Hetro <whee@smaertness.net>\n---\n git-commit.sh |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex d7e7028..1d04f1f 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -49,10 +49,11 @@ run_status () {\n \t\texport GIT_INDEX_FILE\n \tfi\n \n-\tcase \"$status_only\" in\n-\tt) color= ;;\n-\t*) color=--nocolor ;;\n-\tesac\n+\tif test \"$status_only\" = \"t\" -o \"$use_status_color\" = \"t\"; then\n+\t\tcolor=\n+\telse\n+\t\tcolor=--nocolor\n+\tfi\n \tgit runstatus ${color} \\\n \t\t${verbose:+--verbose} \\\n \t\t${amend:+--amend} \\\n@@ -556,6 +557,7 @@ fi\n if [ \"$?\" != \"0\" -a ! -f \"$GIT_DIR/MERGE_HEAD\" -a -z \"$amend\" ]\n then\n \trm -f \"$GIT_DIR/COMMIT_EDITMSG\" \"$GIT_DIR/SQUASH_MSG\"\n+\tuse_status_color=t\n \trun_status\n \texit 1\n fi\n-- \n1.5.3.rc6.23.g0058-dirty\n"},{"id":"51649","messageId":"20070827082550.GC17373@coredump.intra.peff.net","threadId":"9657","inReplyTo":"20070826183526.GA16359@ruiner","subject":"Re: [PATCH] When nothing to git-commit, honor the git-status color setting.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-08-27T08:25:50Z","receivedAt":"2007-08-27T08:25:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Aug 26, 2007 at 02:35:26PM -0400, Brian Hetro wrote:\n\n> Instead of disabling color all of the time during a git-commit, allow\n> the user's config preference in the situation where there is nothing\n> to commit.  In this situation, the status is printed to the terminal\n> and not sent to COMMIT_EDITMSG, so honoring the status color setting\n> is expected.\n\nThanks, this had been annoying me for a while. For some reason, I was\nthinking that it was not going to be trivial to fix, because I thought\nfor efficiency reasons we only ran run_status once and used the output\nfor either the commit template or for dumping to the user. But I can't\nseem to find any revision where that is the case, so obviously somebody\nspiked my drink. For a month.\n\nA minor nit on the implementation:\n\n> +\tif test \"$status_only\" = \"t\" -o \"$use_status_color\" = \"t\"; then\n> +\t\tcolor=\n> +\telse\n> +\t\tcolor=--nocolor\n> +\tfi\n\nThis variable doesn't really say \"use color\"; it says \"don't explicitly\nturn off color\". So perhaps there is a better name (respect_color or\nsimilar)?\n\n-Peff\n"},{"id":"51666","messageId":"20070827094543.GA8014@ruiner","threadId":"9657","inReplyTo":"20070827082550.GC17373@coredump.intra.peff.net","subject":"Re: [PATCH] When nothing to git-commit, honor the git-status color setting.","fromName":"Brian Hetro","fromEmail":"whee@smaertness.net","sentAt":"2007-08-27T09:45:43Z","receivedAt":"2007-08-27T09:45:43Z","isPatch":true,"sender":{"key":"whee@smaertness.net","avatar":"https://gravatar.com/avatar/1d20c40734a674e76a0a58c6d122ef493291db306d613a40653a035084d557b9?d=mp&s=160"},"body":"On Mon, Aug 27, 2007 at 04:25:50 -0400, Jeff King wrote:\n> On Sun, Aug 26, 2007 at 02:35:26PM -0400, Brian Hetro wrote:\n> \n> > Instead of disabling color all of the time during a git-commit, allow\n> > the user's config preference in the situation where there is nothing\n> > to commit.  In this situation, the status is printed to the terminal\n> > and not sent to COMMIT_EDITMSG, so honoring the status color setting\n> > is expected.\n\n> A minor nit on the implementation:\n> \n> > +\tif test \"$status_only\" = \"t\" -o \"$use_status_color\" = \"t\"; then\n> > +\t\tcolor=\n> > +\telse\n> > +\t\tcolor=--nocolor\n> > +\tfi\n> \n> This variable doesn't really say \"use color\"; it says \"don't explicitly\n> turn off color\". So perhaps there is a better name (respect_color or\n> similar)?\n\nI was thinking more along the lines of \"use color as if you had run\ngit-status\" when I decided on $use_status_color.  Perhaps there is a\nbetter name.\n\nBrian\n"},{"id":"51677","messageId":"20070827101509.GB23248@coredump.intra.peff.net","threadId":"9657","inReplyTo":"20070827094543.GA8014@ruiner","subject":"Re: [PATCH] When nothing to git-commit, honor the git-status color setting.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-08-27T10:15:09Z","receivedAt":"2007-08-27T10:15:09Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 27, 2007 at 05:45:43AM -0400, Brian Hetro wrote:\n\n> I was thinking more along the lines of \"use color as if you had run\n> git-status\" when I decided on $use_status_color.  Perhaps there is a\n> better name.\n\nI wonder if the implementation below is slightly more readable.\n\nBTW, I suspect Junio will not apply this until post-1.5.3; I am starting\na queue of such patches that I care about and will re-send after the\nrelease.\n\n-Peff\n\n---\ndiff --git a/git-commit.sh b/git-commit.sh\nindex d7e7028..96cec04 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -13,6 +13,7 @@ git rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t\n case \"$0\" in\n *status)\n \tstatus_only=t\n+\tno_override_color=t\n \t;;\n *commit)\n \tstatus_only=\n@@ -49,7 +50,7 @@ run_status () {\n \t\texport GIT_INDEX_FILE\n \tfi\n \n-\tcase \"$status_only\" in\n+\tcase \"$no_override_color\" in\n \tt) color= ;;\n \t*) color=--nocolor ;;\n \tesac\n@@ -556,7 +557,7 @@ fi\n if [ \"$?\" != \"0\" -a ! -f \"$GIT_DIR/MERGE_HEAD\" -a -z \"$amend\" ]\n then\n \trm -f \"$GIT_DIR/COMMIT_EDITMSG\" \"$GIT_DIR/SQUASH_MSG\"\n-\trun_status\n+\tno_override_color=t run_status\n \texit 1\n fi\n \n\n> \n> Brian\n> \n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"51727","messageId":"20070827161517.GA25484@ruiner","threadId":"9657","inReplyTo":"20070827101509.GB23248@coredump.intra.peff.net","subject":"Re: [PATCH] When nothing to git-commit, honor the git-status color setting.","fromName":"Brian Hetro","fromEmail":"whee@smaertness.net","sentAt":"2007-08-27T16:15:17Z","receivedAt":"2007-08-27T16:15:17Z","isPatch":true,"sender":{"key":"whee@smaertness.net","avatar":"https://gravatar.com/avatar/1d20c40734a674e76a0a58c6d122ef493291db306d613a40653a035084d557b9?d=mp&s=160"},"body":"On Mon, Aug 27, 2007 at 06:15:09 -0400, Jeff King wrote:\n> On Mon, Aug 27, 2007 at 05:45:43AM -0400, Brian Hetro wrote:\n> \n> > I was thinking more along the lines of \"use color as if you had run\n> > git-status\" when I decided on $use_status_color.  Perhaps there is a\n> > better name.\n> \n> I wonder if the implementation below is slightly more readable.\n\nI do prefer your implementation.  There is no need to depend on\nstatus_only here.\n\n> I am starting a queue of such patches that I care about and will\n> re-send after the release.\n\nPlease do.\n\n> ---\n> diff --git a/git-commit.sh b/git-commit.sh\n> index d7e7028..96cec04 100755\n> --- a/git-commit.sh\n> +++ b/git-commit.sh\n> @@ -13,6 +13,7 @@ git rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t\n>  case \"$0\" in\n>  *status)\n>  \tstatus_only=t\n> +\tno_override_color=t\n>  \t;;\n>  *commit)\n>  \tstatus_only=\n> @@ -49,7 +50,7 @@ run_status () {\n>  \t\texport GIT_INDEX_FILE\n>  \tfi\n>  \n> -\tcase \"$status_only\" in\n> +\tcase \"$no_override_color\" in\n>  \tt) color= ;;\n>  \t*) color=--nocolor ;;\n>  \tesac\n> @@ -556,7 +557,7 @@ fi\n>  if [ \"$?\" != \"0\" -a ! -f \"$GIT_DIR/MERGE_HEAD\" -a -z \"$amend\" ]\n>  then\n>  \trm -f \"$GIT_DIR/COMMIT_EDITMSG\" \"$GIT_DIR/SQUASH_MSG\"\n> -\trun_status\n> +\tno_override_color=t run_status\n>  \texit 1\n>  fi\n"}]}