* bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize stashes @ 2022-11-09 21:22 Morgan Smith 2022-11-11 12:44 ` Stefan Kangas 0 siblings, 1 reply; 5+ messages in thread From: Morgan Smith @ 2022-11-09 21:22 UTC (permalink / raw) To: 59158 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: 0001-vc-git-Ensure-git-doesn-t-try-to-colorize-stashes.patch --] [-- Type: text/x-patch, Size: 1008 bytes --] From 3a5b77c93742ea0ad5ad89d8af3531f18411b88a Mon Sep 17 00:00:00 2001 From: Morgan Smith <Morgan.J.Smith@outlook.com> Date: Wed, 9 Nov 2022 16:16:55 -0500 Subject: [PATCH] vc-git: Ensure git doesn't try to colorize stashes * lisp/vc/vc-git.el (vc-git-stash-show): Add --color=never to git flags --- lisp/vc/vc-git.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 74536309e2..a1ff03144b 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1883,7 +1883,8 @@ This command shares argument histories with \\[rgrep] and \\[grep]." "Show the contents of stash NAME." (interactive (list (vc-git-stash-read "Show stash: "))) (vc-setup-buffer "*vc-git-stash*") - (vc-git-command "*vc-git-stash*" 'async nil "stash" "show" "-p" name) + (vc-git-command "*vc-git-stash*" 'async nil + "stash" "show" "--color=never" "-p" name) (set-buffer "*vc-git-stash*") (setq buffer-read-only t) (diff-mode) -- 2.38.0 [-- Attachment #2: Type: text/plain, Size: 260 bytes --] 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize stashes 2022-11-09 21:22 bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize stashes Morgan Smith @ 2022-11-11 12:44 ` Stefan Kangas [not found] ` <DM5PR03MB3163A214577D525A6F90C9D7C5009@DM5PR03MB3163.namprd03.prod.outlook.com> 0 siblings, 1 reply; 5+ messages in thread From: Stefan Kangas @ 2022-11-11 12:44 UTC (permalink / raw) To: Morgan Smith; +Cc: 59158 Morgan Smith <Morgan.J.Smith@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? ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <DM5PR03MB3163A214577D525A6F90C9D7C5009@DM5PR03MB3163.namprd03.prod.outlook.com>]
* bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize stashes [not found] ` <DM5PR03MB3163A214577D525A6F90C9D7C5009@DM5PR03MB3163.namprd03.prod.outlook.com> @ 2022-11-12 5:00 ` Stefan Kangas 2022-11-12 17:57 ` Juri Linkov 0 siblings, 1 reply; 5+ messages in thread From: Stefan Kangas @ 2022-11-12 5:00 UTC (permalink / raw) To: Morgan Smith; +Cc: 59158, Juri Linkov [Please use "Reply to all" so that the discussion is recorded in the bug tracker.] Morgan Smith <Morgan.J.Smith@outlook.com> writes: > Stefan Kangas <stefankangas@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@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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize stashes 2022-11-12 5:00 ` Stefan Kangas @ 2022-11-12 17:57 ` Juri Linkov 2022-11-12 19:41 ` Stefan Kangas 0 siblings, 1 reply; 5+ messages in thread From: Juri Linkov @ 2022-11-12 17:57 UTC (permalink / raw) To: Stefan Kangas; +Cc: Morgan Smith, 59158 > 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize stashes 2022-11-12 17:57 ` Juri Linkov @ 2022-11-12 19:41 ` Stefan Kangas 0 siblings, 0 replies; 5+ messages in thread From: Stefan Kangas @ 2022-11-12 19:41 UTC (permalink / raw) To: Juri Linkov; +Cc: Morgan Smith, 59158 close 59158 29.1 thanks Juri Linkov <juri@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). ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-12 19:41 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-11-09 21:22 bug#59158: [PATCH] vc-git: Ensure git doesn't try to colorize stashes Morgan Smith 2022-11-11 12:44 ` Stefan Kangas [not found] ` <DM5PR03MB3163A214577D525A6F90C9D7C5009@DM5PR03MB3163.namprd03.prod.outlook.com> 2022-11-12 5:00 ` Stefan Kangas 2022-11-12 17:57 ` Juri Linkov 2022-11-12 19:41 ` Stefan Kangas
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.