After this commit:
    4c7f1819b3c142ace98269a556bc929c80e7c9fd make color.ui default to 'auto'
the patch file for '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 <>
 builtin/add.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/add.c b/builtin/add.c
index f45d9d4..8266a9c 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -343,6 +343,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;
        out = open(file, O_CREAT | O_WRONLY, 0666);
        if (out < 0)

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to