Quote quotes with a backslash in the "guilt graph" output.  Otherwise,
the "dot" file could contain syntax errors.

Added a test case.

Signed-off-by: Per Cederqvist <ced...@opera.com>
Signed-off-by: Josef 'Jeff' Sipek <jef...@josefsipek.net>
---
 guilt-graph          |  2 ++
 regression/t-033.out | 22 ++++++++++++++++++++++
 regression/t-033.sh  |  9 +++++++++
 3 files changed, 33 insertions(+)

diff --git a/guilt-graph b/guilt-graph
index 924a63e..0857e0d 100755
--- a/guilt-graph
+++ b/guilt-graph
@@ -57,6 +57,8 @@ while [ "$current" != "$base" ]; do
 }"`
        [ -z "$pname" ] && pname="?"
 
+       pname="`printf \"%s\" \"$pname\" | sed 's/\"/\\\\\"/g'`"
+
        disp "# checking rev $current"
        disp "  \"$current\" [label=\"$pname\"]"
 
diff --git a/regression/t-033.out b/regression/t-033.out
index 3d1c61f..c120d4f 100644
--- a/regression/t-033.out
+++ b/regression/t-033.out
@@ -66,3 +66,25 @@ digraph G {
        "ff2775f8d1dc753f635830adcc3a067e0b681e2d" [label="a.patch"]
        "891bc14b5603474c9743fd04f3da888644413dc5" -> 
"ff2775f8d1dc753f635830adcc3a067e0b681e2d"; // ?
 }
+% guilt new a-"better&quicker'-patch.patch
+% git add file.txt
+% guilt refresh
+Patch a-"better&quicker'-patch.patch refreshed
+% guilt pop
+Now at c.patch.
+% guilt push
+Applying patch..a-"better&quicker'-patch.patch
+Patch applied.
+% guilt graph
+digraph G {
+# checking rev bc7df666a646739eaf559af23cab72f2bfd01f0e
+       "bc7df666a646739eaf559af23cab72f2bfd01f0e" 
[label="a-\"better&quicker'-patch.patch"]
+# checking rev 891bc14b5603474c9743fd04f3da888644413dc5
+       "891bc14b5603474c9743fd04f3da888644413dc5" [label="c.patch"]
+       "bc7df666a646739eaf559af23cab72f2bfd01f0e" -> 
"891bc14b5603474c9743fd04f3da888644413dc5"; // ?
+# checking rev c7014443c33d2b0237293687ceb9cbd38313df65
+       "c7014443c33d2b0237293687ceb9cbd38313df65" [label="b.patch"]
+# checking rev ff2775f8d1dc753f635830adcc3a067e0b681e2d
+       "ff2775f8d1dc753f635830adcc3a067e0b681e2d" [label="a.patch"]
+       "891bc14b5603474c9743fd04f3da888644413dc5" -> 
"ff2775f8d1dc753f635830adcc3a067e0b681e2d"; // ?
+}
diff --git a/regression/t-033.sh b/regression/t-033.sh
index fac081e..9fe1827 100755
--- a/regression/t-033.sh
+++ b/regression/t-033.sh
@@ -50,3 +50,12 @@ cmd git add file.txt
 cmd guilt refresh
 fixup_time_info c.patch
 cmd guilt graph
+
+# A patch name that contains funky characters, including unbalanced
+# quotes.
+cmd guilt new "a-\"better&quicker'-patch.patch"
+cmd echo d >> file.txt
+cmd git add file.txt
+cmd guilt refresh
+fixup_time_info "a-\"better&quicker'-patch.patch"
+cmd guilt graph
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to