{"thread":{"id":"7986","subject":"[PATCH] Make --color available to git-status","startedAt":"2007-05-05T17:37:49Z","lastAt":"2007-05-06T20:53:43Z","messageCount":4,"participants":["Matthieu Moy","Johannes Schindelin","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"41146","messageId":"11783866694076-git-send-email-Matthieu.Moy@imag.fr","threadId":"7986","inReplyTo":null,"subject":"[PATCH] Make --color available to git-status","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-05-05T17:37:49Z","receivedAt":"2007-05-05T17:37:49Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Git has a nice colored output for status, using\n\n$ git runstatus --color\n\nHowever, this --color is not made available to git-status itself. In\nmy understanding, runstatus is plumbing, while status is porcelain,\nwhich the average user wants to use.\n\nThis patch makes --color available to git-status itself, and documents\nit.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n Documentation/git-commit.txt |    4 ++++\n Documentation/git-status.txt |    5 ++++-\n git-commit.sh                |   10 ++++++++--\n 3 files changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 53a7bb0..2895225 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -118,6 +118,10 @@ but can be used to amend a merge commit.\n -q|--quiet::\n \tSuppress commit summary message.\n \n+--color::\n+\tIgnored by git-commit, but present for compatibility with\n+\tgitlink:git-status[1]. Show colored output for git-status.\n+\n \\--::\n \tDo not interpret any more arguments as options.\n \ndiff --git a/Documentation/git-status.txt b/Documentation/git-status.txt\nindex e9e193f..1d6a240 100644\n--- a/Documentation/git-status.txt\n+++ b/Documentation/git-status.txt\n@@ -23,9 +23,12 @@ If there is no path that is different between the index file and\n the current HEAD commit, the command exits with non-zero\n status.\n \n+\n+OPTIONS\n+-------\n The command takes the same set of options as `git-commit`; it\n shows what would be committed if the same options are given to\n-`git-commit`.\n+`git-commit`.  If --color is used, show a colored output.\n \n \n OUTPUT\ndiff --git a/git-commit.sh b/git-commit.sh\nindex f28fc24..47f006f 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -3,7 +3,7 @@\n # Copyright (c) 2005 Linus Torvalds\n # Copyright (c) 2006 Junio C Hamano\n \n-USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'\n+USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--color] [[-i | -o] <path>...]'\n SUBDIRECTORY_OK=Yes\n . git-sh-setup\n require_work_tree\n@@ -50,7 +50,7 @@ run_status () {\n \tfi\n \n \tcase \"$status_only\" in\n-\tt) color= ;;\n+\tt) ;;\n \t*) color=--nocolor ;;\n \tesac\n \tgit-runstatus ${color} \\\n@@ -87,6 +87,8 @@ signoff=\n force_author=\n only_include_assumed=\n untracked_files=\n+color=\n+\n while case \"$#\" in 0) break;; esac\n do\n \tcase \"$1\" in\n@@ -262,6 +264,10 @@ $1\"\n \t\tuntracked_files=t\n \t\tshift\n \t\t;;\n+\t--c|--co|--col|--colo|--color)\n+                color=--color\n+                shift\n+                ;;\n \t--)\n \t\tshift\n \t\tbreak\n-- \n1.5.1.3\n"},{"id":"41153","messageId":"Pine.LNX.4.64.0705051956200.4015@racer.site","threadId":"7986","inReplyTo":"11783866694076-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] Make --color available to git-status","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-05T17:58:45Z","receivedAt":"2007-05-05T17:58:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 5 May 2007, Matthieu Moy wrote:\n\n> Git has a nice colored output for status, using\n> \n> $ git runstatus --color\n> \n> However, this --color is not made available to git-status itself.\n\nAFAIR there have been attempts to enable this by default, when git-status \nis run interactively (i.e. its output is not piped). However, this proved \nto be remarkably complex, given that the output of runstatus _is_ piped.\n\nIMHO the proper solution would be to go the full nine yards, and teach \nrunstatus about the remaining parts of git-status. Then, automatic color \nworks automatically.\n\nCiao,\nDscho\n"},{"id":"41211","messageId":"vpq64762gwa.fsf@bauges.imag.fr","threadId":"7986","inReplyTo":"Pine.LNX.4.64.0705051956200.4015@racer.site","subject":"Re: [PATCH] Make --color available to git-status","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-05-06T13:58:13Z","receivedAt":"2007-05-06T13:58:13Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi,\n>\n> On Sat, 5 May 2007, Matthieu Moy wrote:\n>\n>> Git has a nice colored output for status, using\n>> \n>> $ git runstatus --color\n>> \n>> However, this --color is not made available to git-status itself.\n>\n> AFAIR there have been attempts to enable this by default, when git-status \n> is run interactively (i.e. its output is not piped). However, this proved \n> to be remarkably complex, given that the output of runstatus _is_ piped.\n\nIt would definitely be cool to have it enabled by default, but just\nhaving the option (which means in particular that users can use it in\nan alias) should be the minimum.\n\nI don't have enough experience with git hacking to do all the way you\nsuggest, so I'm starting with easy things ;-).\n\n-- \nMatthieu\n"},{"id":"41249","messageId":"20070506205343.GA9670@coredump.intra.peff.net","threadId":"7986","inReplyTo":"Pine.LNX.4.64.0705051956200.4015@racer.site","subject":"Re: [PATCH] Make --color available to git-status","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-05-06T20:53:43Z","receivedAt":"2007-05-06T20:53:43Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, May 05, 2007 at 07:58:45PM +0200, Johannes Schindelin wrote:\n\n> AFAIR there have been attempts to enable this by default, when git-status \n> is run interactively (i.e. its output is not piped). However, this proved \n> to be remarkably complex, given that the output of runstatus _is_ piped.\n\nI have been running with \"status.color\" set to \"auto\" for months, and it\nworks fine. git-status sends the output of runstatus to stdout; only\ngit-commit saves it in a file. However, that is irrelevant here since\ngit-commit explicitly turns off color anyway. The reason for this is\nthat the result ends up in the user's editor and in the commit object.\nIn the editor, it is more elegant to do syntax highlighting at that\nlevel (otherwise you have to edit around the escape codes). For the\ncommit object, we would have to put in code to strip the colorization.\n\nMy biggest complaint is that git-commit shows the runstatus output to\nthe user if there is nothing to commit, but it isn't colorized (because\nwe created it with the intent of running the editor on it). This could\nbe fixed at the expense of slightly more CPU by simply re-running\nrunstatus instead of using the saved copy.\n\n> IMHO the proper solution would be to go the full nine yards, and teach \n> runstatus about the remaining parts of git-status. Then, automatic color \n> works automatically.\n\nWhen I rewrote runstatus in C, it was always my intent that it just be a\nfirst step in turning git-status into a C builtin (with the ultimate\ngoal of improving the output by parallel walking the HEAD, index, and\nworking tree).  Unfortunately, I don't seem to have gotten around to\nit...\n\n-Peff\n"}]}