git add -e: Explicitly specify that patch should have no color
authorAndrew Wong <andrew.kw.w@gmail.com>
Thu, 18 Jul 2013 22:58:04 +0000 (18:58 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jul 2013 18:20:28 +0000 (11:20 -0700)
After 4c7f1819 (make color.ui default to 'auto', 2013-06-10), the
patch file to be edited during 'git add -e' receives all the color
codes. This is because diffopt.use_color defaults to -1, which
causes want_color to now return 'auto'.

By explicitly setting use_color to 0, we can ensure the diff output
has no color codes in it.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/add.c
index ab1c9e8fb7a0f7c6f60cc78ff0f345838210459a..8b2aa5bff109e29c13ddff34143e0b4dc64bce4d 100644 (file)
@@ -238,6 +238,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
 
        argc = setup_revisions(argc, argv, &rev, NULL);
        rev.diffopt.output_format = DIFF_FORMAT_PATCH;
+       rev.diffopt.use_color = 0;
        DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
        out = open(file, O_CREAT | O_WRONLY, 0666);
        if (out < 0)