[GUILT 20/28] "guilt graph": Handle patch names containing quotes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Added a test case.
---
 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 575f03b..24ab83b 100755
--- a/guilt-graph
+++ b/guilt-graph
@@ -58,6 +58,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 e638d7b..1c28ea9 100644
--- a/regression/t-033.out
+++ b/regression/t-033.out
@@ -63,3 +63,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 57dce78..968292c 100755
--- a/regression/t-033.sh
+++ b/regression/t-033.sh
@@ -46,3 +46,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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]