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

[PATCH] Checking for "diff.color." should come before "diff.color"

From
APAndy Parkins <andyparkins@gmail.com>
Date
Oct 23, 2006, 19:51 UTC
Message-ID
<200610232051.17396.andyparkins@gmail.com>

In git_diff_ui_config() the strncmp() for "diff.color" would have matched for "diff.color.", so "diff.color." configs would never be processed.

Fix is to move "diff.color." check before "diff.color"
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 diff.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/diff.c b/diff.c
index 3315378..d795be4 100644
--- a/diff.c
+++ b/diff.c
@@ -60,10 +60,6 @@ int git_diff_ui_config(const char *var, 
 		diff_rename_limit_default = git_config_int(var, value);
 		return 0;
 	}
-	if (!strcmp(var, "diff.color")) {
-		diff_use_color_default = git_config_colorbool(var, value);
-		return 0;
-	}
 	if (!strcmp(var, "diff.renames")) {
 		if (!value)
 			diff_detect_rename_default = DIFF_DETECT_RENAME;
@@ -79,6 +75,10 @@ int git_diff_ui_config(const char *var, 
 		color_parse(value, var, diff_colors[slot]);
 		return 0;
 	}
+	if (!strcmp(var, "diff.color")) {
+		diff_use_color_default = git_config_colorbool(var, value);
+		return 0;
+	}
 	return git_default_config(var, value);
 }
 
-- 
1.4.2.3
Next: Jeff King
Message 1 of 5 in “Checking for "diff.color." should come before "diff.color"”
  1. Checking for "diff.color." should come before "diff.color"Andy Parkins, Oct 23, 2006
  2. Jeff KingOct 23, 2006
  3. Andy ParkinsOct 23, 2006
  4. Jeff KingOct 23, 2006
  5. Andy ParkinsOct 23, 2006

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.