gitk: Allow unbalanced quotes/braces in commit headers
When parsing commits, gitk treats the headers of the commit as tcl lists. This causes errors if the header contains an unbalanced quote or open brace. Splitting the line on spaces allows us to treat it as a set of words instead of as a tcl list, which prevents errors. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Kevin Ballard committed
Dec 18, 2008 at 01:26 UTC
61f57cb07d88e06a2027a4a4c571c59d353361a5
1 file changed
+3
-2
gitk
+3
-2
@@ -1601,13 +1601,14 @@ proc parsecommit {id contents listed} {
1601
set header [string range $contents 0 [expr {$hdrend - 1}]]
1602
set comment [string range $contents [expr {$hdrend + 2}] end]
1603
foreach line [split $header "\n"] {
1604
+ set line [split $line " "]
1605
set tag [lindex $line 0]
1606
if {$tag == "author"} {
1607
set audate [lindex $line end-1]
1607
- set auname [lrange $line 1 end-2]
1608
+ set auname [join [lrange $line 1 end-2] " "]
1609
} elseif {$tag == "committer"} {
1610
set comdate [lindex $line end-1]
1610
- set comname [lrange $line 1 end-2]
1611
+ set comname [join [lrange $line 1 end-2] " "]
1612
}
1613
}
1614
set headline {}