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

Re: Updated to v2.14.2 on macOS; git add --patch broken

From
Jeff King <peff@peff.net>
Date
Oct 3, 2017, 09:31 UTC
Message-ID
<20171003093157.gq7za2fwcqsouire@sigill.intra.peff.net>
In-Reply-To
<20171003061515.72l35fpvcf63vsf6@sigill.intra.peff.net>
On Tue, Oct 03, 2017 at 02:15:15AM -0400, Jeff King wrote:
Show 28 quoted lines
> The two reasonable paths forward to me are:
> 
>   1. Do nothing. Putting "color.ui = always" in your on-disk config is a
>      bad idea, and the right fix is to stop doing it.
> 
>   2. Make "always" a synonym for "auto". This has the advantage over (1)
>      that you can't shoot yourself in the foot with it (so the expanded
>      foot-shooting capabilities of 4c7f1819b don't matter). The
>      disadvantage is that you can no longer do:
> 
>        git -c color.ui=always foo >not-a-tty
> 
>      to ask for color in all sub-programs of "foo". I have no idea if
>      anybody cares. I came up with that example in 4c7f1819b as the most
>      plausible reason somebody might actually care about "always", but
>      I've never used it myself.
> 
>      And there _is_ a way to get the same thing, which is:
> 
>        GIT_PAGER_IN_USE=1 git foo >not-a-tty
> 
>      I.e., stay in "auto" but make the claim that "auto" really ought to
>      be showing color because the output is going to be consumed
>      eventually by a human.  While it looks a bit funny in my made-up
>      example above (because the variables says "pager" but we're not
>      actually piping to a pager directly), I think this is the most
>      plausible reason that an actual program might want to override the
>      auto-color decision.

I've got a series mostly done for option 2. It actually touches quite a few of the test scripts, since we use "-c color.ui=always" to test color output. Normally having to touch the test suite a lot gives me pause that we're breaking something for real users, but I think in this case the test suite is doing something that normal users simply don't.

A variant of 2 (let's call it 2a) is to convert "always" to "auto" _only_ for on-disk config, allowing "-c" to still work. This dull the test-suite pain, but there are still several test scripts which use test_config and need updating. And it introduces a weird inconsistency that I'd just as soon skip.

If we buy into the idea that "color.ui=always" is actually a useful construct to put in your on-disk config (and I'm not sure that I do), then our options are basically:

  3. Go back to the earlier behavior, which i what Junio's 2-patch
     revert series does. That has two issues though:
       - after patch 2, for-each-ref still respects color.ui=always,
	 even though it's plumbing. This is maybe-OK because we don't
	 generate colors unless somebody puts %C() codes into their
	 format.
       - plumbing like diff-tree still doesn't respect color.ui=never
  4. Read color.ui everywhere, but downgrade "always" to "auto" in
     plumbing commands (which would have to mark themselves as such by
     setting a global). This again falls into the "inconsistent and hard
     to explain" category, though I think it at least behaves as people
     would generally want. Except for people who really do want:
       git -c color.always=true foo >file
     to produce color when "foo" is a script that uses diff plumbing
     under the hood. I don't think that _can_ be solved, since from the
     plumbing perspective this is the same as the buggy add--interactive
     case.

I still lean towards option 2 (kill off "always"), but I'm trying to consider the full range of options.

-Peff
Previous: Jan PrachařNext: Junio C Hamano
Message 39 of 42 in “Updated to v2.14.2 on macOS; git add --patch broken”
  1. Toni UebernickelSep 27, 2017
  2. Jeff KingSep 27, 2017
  3. Toni UebernickelSep 27, 2017
  4. Jeff KingSep 27, 2017
  5. Jonathan NiederSep 27, 2017
  6. Jonathan NiederSep 27, 2017
  7. Toni UebernickelSep 28, 2017
  8. Jeff KingSep 28, 2017
  9. Toni UebernickelSep 28, 2017
  10. Jonathan NiederOct 2, 2017
  11. Junio C HamanoOct 3, 2017
  12. Junio C HamanoOct 3, 2017
  13. Junio C HamanoOct 3, 2017
  14. Jeff KingOct 3, 2017
  15. Junio C HamanoOct 3, 2017
  16. Jeff KingOct 3, 2017
  17. Junio C HamanoOct 3, 2017
  18. Jeff KingOct 3, 2017
  19. Junio C HamanoOct 3, 2017
  20. Jeff KingOct 3, 2017
  21. Tsvi MostoviczOct 3, 2017
  22. Junio C HamanoOct 3, 2017
  23. Jeff KingOct 3, 2017
  24. 01/12 test-terminal: set TERM=vt100Jeff King, Oct 3, 2017
  25. 02/12 t4015: prefer --color to -c color.diff=alwaysJeff King, Oct 3, 2017
  26. 03/12 t4015: use --color with --color-movedJeff King, Oct 3, 2017
  27. 04/12 t3701: use test-terminal to collect color outputJeff King, Oct 3, 2017
  28. 05/12 t7508: use test_terminal for color outputJeff King, Oct 3, 2017
  29. 06/12 t7502: use diff.noprefix for --verbose testJeff King, Oct 3, 2017
  30. 07/12 t6006: drop "always" color config testsJeff King, Oct 3, 2017
  31. 08/12 t3203: drop "always" color testJeff King, Oct 3, 2017
  32. 09/12 t7301: use test_terminal to check colorJeff King, Oct 3, 2017
  33. 10/12 t3205: use --color instead of color.branch=alwaysJeff King, Oct 3, 2017
  34. 11/12 provide --color option for all ref-filter usersJeff King, Oct 3, 2017
  35. 12/12 color: make "always" the same as "auto" in configJeff King, Oct 3, 2017
  36. Junio C HamanoOct 4, 2017
  37. Jeff KingOct 5, 2017
  38. Jan PrachařOct 20, 2017
  39. Jeff KingOct 3, 2017
  40. 0/2 fixing "add -p" regressionJunio C Hamano, Oct 3, 2017
  41. 1/2 Revert "color: check color.ui in git_default_config()"Junio C Hamano, Oct 3, 2017
  42. 2/2 colors: git_default_config() does not read color.uiJunio C Hamano, Oct 3, 2017

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.