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
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 2, 2017, 23:00 UTC
Message-ID
<20171002230017.GT19555@aiede.mtv.corp.google.com>
In-Reply-To
<86D0A377-8AFD-460D-A90E-6327C6934DFC@gmail.com>
Hi,
Toni Uebernickel wrote:
Show 6 quoted lines
> I updated to git version v2.14.2 on macOS using homebrew.
>
> Since then `git add --patch` and `git stash save --patch` are not
> working anymore. It's just printing the complete diff without ever
> stopping to ask for actions. This results in an unusable state, as
> the whole command option is rendered useless.
Would a patch like the following help?

I am worried that other scripts using diff-files would need the same kind of patch. So it seems worthwhile to look for alternatives.

An alternative would be to partially roll back v2.14.2~61^2~4 (color: check color.ui in git_default_config, 2017-07-13) by making it not take effect for plumbing commands (i.e., by adding a boolean to "struct startup_info" to indicate whether a command is low-level plumbing). That would make the behavior of Git harder to explain so I don't particularly like it. Plus it defeats the point of the patch.

Yet another alternative would be to treat color.ui=always as a deprecated synonym for color.ui=auto. I think that's my preferred fix.

What do you think?

Thanks again for reporting, Jonathan

diff --git i/git-add--interactive.perl w/git-add--interactive.perl
index 28b325d754..4ea69538c7 100755
--- i/git-add--interactive.perl
+++ w/git-add--interactive.perl
@@ -101,49 +101,49 @@ sub apply_patch_for_stash;
 
 my %patch_modes = (
 	'stage' => {
-		DIFF => 'diff-files -p',
+		DIFF => 'diff-files --no-color -p',
 		APPLY => sub { apply_patch 'apply --cached', @_; },
 		APPLY_CHECK => 'apply --cached',
 		FILTER => 'file-only',
 		IS_REVERSE => 0,
 	},
 	'stash' => {
-		DIFF => 'diff-index -p HEAD',
+		DIFF => 'diff-index --no-color -p HEAD',
 		APPLY => sub { apply_patch 'apply --cached', @_; },
 		APPLY_CHECK => 'apply --cached',
 		FILTER => undef,
 		IS_REVERSE => 0,
 	},
 	'reset_head' => {
-		DIFF => 'diff-index -p --cached',
+		DIFF => 'diff-index --no-color -p --cached',
 		APPLY => sub { apply_patch 'apply -R --cached', @_; },
 		APPLY_CHECK => 'apply -R --cached',
 		FILTER => 'index-only',
 		IS_REVERSE => 1,
 	},
 	'reset_nothead' => {
-		DIFF => 'diff-index -R -p --cached',
+		DIFF => 'diff-index --no-color -R -p --cached',
 		APPLY => sub { apply_patch 'apply --cached', @_; },
 		APPLY_CHECK => 'apply --cached',
 		FILTER => 'index-only',
 		IS_REVERSE => 0,
 	},
 	'checkout_index' => {
-		DIFF => 'diff-files -p',
+		DIFF => 'diff-files --no-color -p',
 		APPLY => sub { apply_patch 'apply -R', @_; },
 		APPLY_CHECK => 'apply -R',
 		FILTER => 'file-only',
 		IS_REVERSE => 1,
 	},
 	'checkout_head' => {
-		DIFF => 'diff-index -p',
+		DIFF => 'diff-index --no-color -p',
 		APPLY => sub { apply_patch_for_checkout_commit '-R', @_ },
 		APPLY_CHECK => 'apply -R',
 		FILTER => undef,
 		IS_REVERSE => 1,
 	},
 	'checkout_nothead' => {
-		DIFF => 'diff-index -R -p',
+		DIFF => 'diff-index --no-color -R -p',
 		APPLY => sub { apply_patch_for_checkout_commit '', @_ },
 		APPLY_CHECK => 'apply',
 		FILTER => undef,
Previous: Toni UebernickelNext: Junio C Hamano
Message 10 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.