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

From: Morgan Smith <[email-masked]>
Date: Wed, 09 Nov 2022 16:22:06 -0500

>From 3a5b77c93742ea0ad5ad89d8af3531f18411b88a Mon Sep 17 00:00:00 2001
From: Morgan Smith <[email-masked]>
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

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