From: Shawn O. Pearce <spearce@spearce.org>
Date: Thu, 8 Feb 2007 22:13:51 +0000 (-0500)
Subject: git-gui: Replace \ with \\ when showing paths.
X-Git-Tag: gitgui-0.6.0~18
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42b922fcf6f3bd16c4579f2b9e1e52c79096eba2;p=git

git-gui: Replace \ with \\ when showing paths.

We already replace \n with \\n so that Tk widgets don't start a new
display line with part of a file path which is just unlucky enough
to contain an LF.  But then its confusing to read a path whose name
actually contains \n as literal characters.  Escaping \ to \\ would
make that case display as \\n, clarifying the output.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---

diff --git a/git-gui.sh b/git-gui.sh
index 8db8789662..1d225644aa 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1381,6 +1381,7 @@ proc mapdesc {state path} {
 }
 
 proc escape_path {path} {
+	regsub -all {\\} $path "\\\\" path
 	regsub -all "\n" $path "\\n" path
 	return $path
 }