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

Re: [PATCH/resend] add--interactive: allow diff colors without interactive colors

From
Matthias Kestenholz <mk@spinlock.ch>
Date
Jan 5, 2008, 14:10 UTC
Message-ID
<1199542226.6209.34.camel@futex>
In-Reply-To
<7vd4sga5n6.fsf@gitster.siamese.dyndns.org>
On Sat, 2008-01-05 at 03:11 -0800, Junio C Hamano wrote:
Show 9 quoted lines
> Matthias Kestenholz <mk@spinlock.ch> writes:
> 
> > I managed to throw something together which works and passes all
> > the tests. Documentation included. :-)
> 
> Is it because we do not usually test colours and the tests run
> without terminals to make sure "color.* = auto" does not kick
> in?
> 

Probably, yes. I've to confess that I have not thought too much about how color output could be tested.

Show 6 quoted lines
> > I would be happy for feedback and suggestions.
> 
>  * Shouldn't "color.git = true" with "color.diff = false" mean
>    "I want colour for everything by default but I do not want to
>    see coloured diff"?
> 
This works with the new patch below.
>  * git_foo_config() callback from git_config() returns 0 on
>    success; the API change needs to be documented to warn
>    others.
> 
I've changed the config reader. It behaves like the others now.
> I haven't studied your patch very deeply so I may have misread
> what you tried to do, regarding the first point, though.
Still missing are the updates for git add -i and git svn.

I have added a new function git_color_config() which should be called after git_config() has finished its work. The function needs to run when all config reading has been done, because otherwise the color setup would be sensitive to the order in which the variables are placed in the config file, which I'd rather avoid.

I've also unified the colorbool variables, because otherwise the individual colorbool variables would need to be exported into other C files, and I don't see the point of multiple colorbools anyway.

The patch got somewhat big, therefore I've splitted it up into several pieces:

[PATCH 1/4] Add infrastructure for a single color config variable
[PATCH 2/4] git branch: Use color configuration infrastructure
[PATCH 3/4] status and commit: Use color configuration infrastructure
[PATCH 4/4] diff and log: Use color configuration infrastructure
Previous: Junio C HamanoNext: Matthias Kestenholz
Message 10 of 17 in “add--interactive: allow diff colors without interactive colors”
  1. add--interactive: allow diff colors without interactive colorsJeff King, Jan 4, 2008
  2. Junio C HamanoJan 5, 2008
  3. Jeff KingJan 5, 2008
  4. Junio C HamanoJan 5, 2008
  5. Jeff KingJan 5, 2008
  6. Junio C HamanoJan 5, 2008
  7. Jeff KingJan 5, 2008
  8. Matthias KestenholzJan 5, 2008
  9. Junio C HamanoJan 5, 2008
  10. Matthias KestenholzJan 5, 2008
  11. 1/4 Add infrastructure for a single color config variableMatthias Kestenholz, Jan 5, 2008
  12. 2/4 git branch: Use color configuration infrastructureMatthias Kestenholz, Jan 5, 2008
  13. 3/4 status and commit: Use color configuration infrastructureMatthias Kestenholz, Jan 5, 2008
  14. 4/4 diff and log: Use color configuration infrastructureMatthias Kestenholz, Jan 5, 2008
  15. Jeff KingJan 8, 2008
  16. Matthias KestenholzJan 8, 2008
  17. Jakub NarebskiJan 5, 2008

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.