git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Make --color available to git-status

From
Jeff King <peff@peff.net>
Date
May 6, 2007, 20:53 UTC
Message-ID
<20070506205343.GA9670@coredump.intra.peff.net>
In-Reply-To
<Pine.LNX.4.64.0705051956200.4015@racer.site>
On Sat, May 05, 2007 at 07:58:45PM +0200, Johannes Schindelin wrote:
> AFAIR there have been attempts to enable this by default, when git-status 
> is run interactively (i.e. its output is not piped). However, this proved 
> to be remarkably complex, given that the output of runstatus _is_ piped.

I have been running with "status.color" set to "auto" for months, and it works fine. git-status sends the output of runstatus to stdout; only git-commit saves it in a file. However, that is irrelevant here since git-commit explicitly turns off color anyway. The reason for this is that the result ends up in the user's editor and in the commit object. In the editor, it is more elegant to do syntax highlighting at that level (otherwise you have to edit around the escape codes). For the commit object, we would have to put in code to strip the colorization.

My biggest complaint is that git-commit shows the runstatus output to the user if there is nothing to commit, but it isn't colorized (because we created it with the intent of running the editor on it). This could be fixed at the expense of slightly more CPU by simply re-running runstatus instead of using the saved copy.

> IMHO the proper solution would be to go the full nine yards, and teach 
> runstatus about the remaining parts of git-status. Then, automatic color 
> works automatically.

When I rewrote runstatus in C, it was always my intent that it just be a first step in turning git-status into a C builtin (with the ultimate goal of improving the output by parallel walking the HEAD, index, and working tree). Unfortunately, I don't seem to have gotten around to it...

-Peff
Previous: Matthieu Moy
Message 4 of 4 in “Make --color available to git-status”
  1. Make --color available to git-statusMatthieu Moy, May 5, 2007
  2. Johannes SchindelinMay 5, 2007
  3. Matthieu MoyMay 6, 2007
  4. Jeff KingMay 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.