GNU bug report logs - #59158
[PATCH] vc-git: Ensure git doesn't try to colorize stashes

Previous Next

Package: emacs;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Wed, 9 Nov 2022 21:23:02 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59158 in the body.
You can then email your comments to 59158 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59158; Package emacs. (Wed, 09 Nov 2022 21:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Morgan Smith <Morgan.J.Smith <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 09 Nov 2022 21:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] vc-git: Ensure git doesn't try to colorize stashes
Date: Wed, 09 Nov 2022 16:22:06 -0500
[0001-vc-git-Ensure-git-doesn-t-try-to-colorize-stashes.patch (text/x-patch, attachment)]
[Message part 2 (text/plain, inline)]
Hello,

So if you've configured git with "git config --global color.ui always"
then "git stash show" will create lots of spurious color escape
characters that our stash viewer code cannot deal with.  This patch
makes sure that doesn't happen

Thanks,

Morgan

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59158; Package emacs. (Fri, 11 Nov 2022 12:45:01 GMT) Full text and rfc822 format available.

Message #8 received at 59158 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Cc: 59158 <at> debbugs.gnu.org
Subject: Re: bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize
 stashes
Date: Fri, 11 Nov 2022 04:44:28 -0800
Morgan Smith <Morgan.J.Smith <at> outlook.com> writes:

> So if you've configured git with "git config --global color.ui always"
> then "git stash show" will create lots of spurious color escape
> characters that our stash viewer code cannot deal with.  This patch
> makes sure that doesn't happen

How can I reproduce this issue, starting from emacs -Q?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59158; Package emacs. (Sat, 12 Nov 2022 05:01:02 GMT) Full text and rfc822 format available.

Message #11 received at 59158 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Cc: 59158 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize
 stashes
Date: Fri, 11 Nov 2022 21:00:00 -0800
[Please use "Reply to all" so that the discussion is recorded in the bug
tracker.]

Morgan Smith <Morgan.J.Smith <at> outlook.com> writes:

> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
>> How can I reproduce this issue, starting from emacs -Q?
>
> I'm using emacs from commit d04433b962
>
>
> A little background first:
>
> So when in Emacs using eshell, git won't give us colored output.  In
> "emacs -Q" we can navigate using eshell to a git repo and type "git
> show HEAD" and we will see no color.  This might prompt us to run "git
> config --global color.ui always".  Now we get all the color with no
> issues.
>
>
> The steps:
>
> Go to a git repo with a stash
>
> Run "git config --global color.ui always"
>
> Run M-x vc-dir (C-x C-v d)
>
> Goto stash and hit RET to open the stash
>
> There are now spurious color control characters everywhere

I still can't reproduce this, using this recipe:

0. emacs -Q
1. C-x d ~/wip/emacs RET
2. C-x C-v d

   I'm now looking at a buffer *vc-dir* that looks like this:

       VC backend : Git
       Working dir: ~/wip/emacs/
       Branch     : master
       Remote     : skangas <at> git.sv.gnu.org:/srv/git/emacs.git
       Stash      : Hide all stashes (11)
                    {0}: On master: assign
                    {1}: On feature/tree-sitter: wip
                    {2}: On master: tree-sitter
       [...snip...]

3. With point on "{0}:", type RET

Now I get a buffer *vc-git-stash* which is using diff-mode, but I don't
see any spurious control characters.

[time passes]

Okay, I see it now, but I had to do this too:

    git config --global color.diff always

But I cannot reproduce it if I use this instead:

    git config --global color.diff auto

However, as Emacs can't process those control characters in any case, I
think we might as well apply the patch you suggest.  This will save
users from shooting themselves in the foot.

Does anyone see any reason not to?

> Thanks,
>
> Morgan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59158; Package emacs. (Sat, 12 Nov 2022 18:12:03 GMT) Full text and rfc822 format available.

Message #14 received at 59158 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>, 59158 <at> debbugs.gnu.org
Subject: Re: bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize
 stashes
Date: Sat, 12 Nov 2022 19:57:16 +0200
> However, as Emacs can't process those control characters in any case, I
> think we might as well apply the patch you suggest.  This will save
> users from shooting themselves in the foot.
>
> Does anyone see any reason not to?

Since --color=never doesn't look like a new option of git diff,
it should be pretty safe to apply the patch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59158; Package emacs. (Sat, 12 Nov 2022 19:42:03 GMT) Full text and rfc822 format available.

Message #17 received at 59158 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>, 59158 <at> debbugs.gnu.org
Subject: Re: bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize
 stashes
Date: Sat, 12 Nov 2022 11:41:54 -0800
close 59158 29.1
thanks

Juri Linkov <juri <at> linkov.net> writes:

>> However, as Emacs can't process those control characters in any case, I
>> think we might as well apply the patch you suggest.  This will save
>> users from shooting themselves in the foot.
>>
>> Does anyone see any reason not to?
>
> Since --color=never doesn't look like a new option of git diff,
> it should be pretty safe to apply the patch.

OK, pushed to master (commit 4ccc385ab1).




bug marked as fixed in version 29.1, send any further explanations to 59158 <at> debbugs.gnu.org and Morgan Smith <Morgan.J.Smith <at> outlook.com> Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 12 Nov 2022 19:42:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Dec 2022 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.