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

[PATCH v4 1/4] diff: make the indent heuristic part of diff's basic configuration

From
Marc Branchaud <marcnarc@xiplink.com>
Date
May 8, 2017, 16:03 UTC
Message-ID
<20170508160339.4551-2-marcnarc@xiplink.com>
In-Reply-To
<20170508160339.4551-1-marcnarc@xiplink.com>

This heuristic was originally introduced as an experimental feature, and therefore part of the UI configuration.

But the user often sees diffs generated by plumbing commands like diff-tree. Moving the indent heuristic into diff's basic configuration prepares the way for diff plumbing commands to respect the setting.

The heuristic itself merely makes the diffs more aesthetically pleasing, without changing their correctness. Scripts that rely on the diff plumbing commands should not care whether or not the heuristic is employed.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
---
 diff.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/diff.c b/diff.c
index 74283d900..b6e3ffe92 100644
--- a/diff.c
+++ b/diff.c
@@ -290,9 +290,6 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
-	if (git_diff_heuristic_config(var, value, cb) < 0)
-		return -1;
-
 	if (!strcmp(var, "diff.wserrorhighlight")) {
 		int val = parse_ws_error_highlight(value);
 		if (val < 0)
@@ -351,6 +348,9 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
 	if (starts_with(var, "submodule."))
 		return parse_submodule_config_option(var, value);
 
+	if (git_diff_heuristic_config(var, value, cb) < 0)
+		return -1;
+
 	return git_default_config(var, value, cb);
 }
 
-- 
2.13.0.rc1.15.gf67d331ad
Previous: Marc BranchaudNext: Marc Branchaud
Message 4 of 14 in “What's cooking in git.git (May 2017, #02; Mon, 8)”
  1. Junio C HamanoMay 8, 2017
  2. Enabling the diff "indent" heuristic by defaultMarc Branchaud, May 8, 2017
  3. 0/4 Make diff plumbing commands respect the indentHeuristic.Marc Branchaud, May 8, 2017
  4. 1/4 diff: make the indent heuristic part of diff's basic configurationMarc Branchaud, May 8, 2017
  5. 4/4 add--interactive: drop diff.indentHeuristic handlingMarc Branchaud, May 8, 2017
  6. Jeff KingMay 9, 2017
  7. 2/4 diff: have the diff-* builtins configure diff before initializing revisionsMarc Branchaud, May 8, 2017
  8. Jeff KingMay 9, 2017
  9. Marc BranchaudMay 11, 2017
  10. 3/4 diff: enable indent heuristic by defaultMarc Branchaud, May 8, 2017
  11. Stefan BellerMay 8, 2017
  12. Jeff KingMay 9, 2017
  13. Jeff KingMay 9, 2017
  14. Jeff KingMay 9, 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.