format-patch: ignore ui.color
commit c9bfb953 (want_color: automatically fallback to color.ui, 2011-08-17) introduced a regression where format-patch produces colorized patches when color.ui is set to "always". In f3aafa4 (Disable color detection during format-patch, 2006-07-09), git_format_config was taught to intercept diff.color to avoid passing it down to git_log_config and later, git_diff_ui_config. Teach git_format_config to intercept color.ui in the same way. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pang Yan Han committed
Sep 13, 2011 at 01:46 UTC
787570c7cddea7ffe3cb2e52c8af169bb17ba29b
2 files changed
+10
-1
builtin/log.c
+2
-1
@@ -608,7 +608,8 @@ static int git_format_config(const char *var, const char *value, void *cb)
608
string_list_append(&extra_cc, value);
609
return 0;
610
}
611
- if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
611
+ if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff") ||
612
+ !strcmp(var, "color.ui")) {
613
return 0;
614
}
615
if (!strcmp(var, "format.numbered")) {
t/t4014-format-patch.sh
+8
@@ -869,4 +869,12 @@ test_expect_success 'empty subject prefix does not have extra space' '
869
test_cmp expect actual
870
'
871
872
+test_expect_success 'format patch ignores color.ui' '
873
+ test_unconfig color.ui &&
874
+ git format-patch --stdout -1 >expect &&
875
+ test_config color.ui always &&
876
+ git format-patch --stdout -1 >actual &&
877
+ test_cmp expect actual
878
+'
879
+
880
test_done