Checking for "diff.color." should come before "diff.color"
PATCH 1/1 Checking for "diff.color." should come before "diff.color"
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"
--- diff.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff.c +4 -4
@@ -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); }
Signature · 1 line
1.4.2.3
Quoted 3 lines · Andy Parkins
In
git_diff_ui_config()thestrncmp()for "diff.color" would have matched for "diff.color.", so "diff.color." configs would never be processed.
No, it's a strcmp for "diff.color", so it must match exactly. The code is fine.
Are you experiencing some bug, or was this just from poking through the code?
-Peff
Quoted 2 lines · Jeff King
No, it's a strcmp for "diff.color", so it must match exactly. The code is fine.
Oops. Yep. So far I'm zero for five on my git patches - not doing too well am I? :-)
Quoted 2 lines
Are you experiencing some bug, or was this just from poking through the code?
Nah; poking around only. I'm playing with git using the git repository. I have a feeling it's making me noisy and annoying.
Andy
Signature · 2 lines
Dr Andrew Parkins, M Eng (Hons), AMIEE [email protected]
Quoted 2 lines · Andy Parkins
Oops. Yep. So far I'm zero for five on my git patches - not doing too well am I? :-)
Keep trying. Many eyes on the code is never a bad thing, and fortunately there are many eyes on your patches, too. :)
-Peff
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Junio C Hamano
Quoted 2 lines · Andy Parkins
In
git_diff_ui_config()thestrncmp()for "diff.color" would have matched for "diff.color.", so "diff.color." configs would never be processed.A test case that demonstrates the breakage without the patch would be nice. Could you come up with a two-patch series that is:
No need. Jeff King already caught the fact that my patch is unnecessary. I withdraw it.
Sorry to keep bothering you all with these non-entity patches. I really am only trying to help :-)
Andy
Signature · 2 lines
Dr Andrew Parkins, M Eng (Hons), AMIEE [email protected]