git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git add -e: Explicitly specify that patch should have no color

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jul 19, 2013, 08:49 UTC
Message-ID
<vpqehavndcq.fsf@anie.imag.fr>
In-Reply-To
<1374188284-27638-1-git-send-email-andrew.kw.w@gmail.com>
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.

Show 10 quoted lines
> --- 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/
Previous: Andrew Wong
Message 2 of 2 in “git add -e: Explicitly specify that patch should have no color”
  1. git add -e: Explicitly specify that patch should have no colorAndrew Wong, Jul 18, 2013
  2. Matthieu MoyJul 19, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.