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

Re: [PATCH] color.h: document and modernize header

From
Jeff King <peff@peff.net>
Date
Feb 8, 2018, 22:28 UTC
Message-ID
<20180208222851.GA8850@sigill.intra.peff.net>
In-Reply-To
<CAPig+cTZuf5rMNN6aSztX-jKrJkuRpVcJj+xmrSsO6ngrHhU6Q@mail.gmail.com>
On Thu, Feb 08, 2018 at 05:26:33PM -0500, Eric Sunshine wrote:
Show 13 quoted lines
> > I think the point is that "var" is a quad-state variable (yes, no, auto,
> > or "unknown") and we are converting to a boolean. This would probably be
> > a lot more clear if GIT_COLOR_* were all enum values and not #defines,
> > and this function took the matching enum type.
> >
> > So I think that's what you were trying to name with "constants as
> > returned by...", but it definitely took me some thinking to parse it.
> 
> Rather than talking about plural "constants" (which makes it more
> confusing), it would likely be helpful for it to say (explicitly) that
> the caller passes in the result of git_config_colorbool() as 'var'.
> 
> Or something like that.

That's not quite it, though. "var" is really the current program's idea of whether color has been requested. So it's git_config_colorbool(), as modified by things like "--color".

I think the best explanation is that it resolves an "enum color_bool" into a single 0/1 boolean. Except that "enum color_bool" doesn't exist, so we have no name for it.

-Peff
Previous: Eric SunshineNext: Stefan Beller
Message 10 of 16 in “color.h: document and modernize header”
  1. color.h: document and modernize headerStefan Beller, Feb 8, 2018
  2. Jeff KingFeb 8, 2018
  3. Stefan BellerFeb 8, 2018
  4. CodingGuidelines: mention "static" and "extern"Jeff King, Feb 8, 2018
  5. Stefan BellerFeb 8, 2018
  6. Eric SunshineFeb 8, 2018
  7. Jonathan TanFeb 9, 2018
  8. Jeff KingFeb 9, 2018
  9. Eric SunshineFeb 8, 2018
  10. Jeff KingFeb 8, 2018
  11. color.h: document and modernize headerStefan Beller, Feb 12, 2018
  12. Eric SunshineFeb 12, 2018
  13. color.h: document and modernize headerStefan Beller, Feb 13, 2018
  14. Eric SunshineFeb 13, 2018
  15. Eric SunshineFeb 14, 2018
  16. Stefan BellerFeb 14, 2018

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.