* [PATCH] git add -e: Explicitly specify that patch should have no color
@ 2013-07-18 22:58 Andrew Wong
2013-07-19 8:49 ` Matthieu Moy
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Wong @ 2013-07-18 22:58 UTC (permalink / raw)
To: git; +Cc: Matthieu.Moy, Andrew Wong
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 <andrew.kw.w@gmail.com>
---
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;
DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
out = open(file, O_CREAT | O_WRONLY, 0666);
if (out < 0)
--
1.8.3.3.755.gbf91598
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] git add -e: Explicitly specify that patch should have no color
2013-07-18 22:58 [PATCH] git add -e: Explicitly specify that patch should have no color Andrew Wong
@ 2013-07-19 8:49 ` Matthieu Moy
0 siblings, 0 replies; 2+ messages in thread
From: Matthieu Moy @ 2013-07-19 8:49 UTC (permalink / raw)
To: Andrew Wong; +Cc: git
Andrew Wong <andrew.kw.w@gmail.com> writes:
> 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'.
Oops, indeed. The code was relying on the user's config not being loaded
(hence color.ui was previously ignored), and now has to explicitely
disable color.
I'm wondering whether there are other instances of this. I checked that
"git format-patch" is not broken, but I hope we did not forget others.
> --- 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;
> DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
> out = open(file, O_CREAT | O_WRONLY, 0666);
> if (out < 0)
Acknowledged-by: Matthieu Moy <Matthieu.Moy@imag.fr>
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-19 8:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-18 22:58 [PATCH] git add -e: Explicitly specify that patch should have no color Andrew Wong
2013-07-19 8:49 ` Matthieu Moy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).