@matheusbsbs / matheus-bagliano / commits / 86291555c9
Fork 0

git-gui: Fix list loading corruption introduced by 1461c5f3.

Tcl let me assign two different types of values to the variable $n. Prior to 1461c5f3 $n was the total number of bytes in the string; but in that commit it also became the current info list for the current file. This caused $c < $n to fail as $n was now treated as 0 and we only loaded the first file in each buffer. So use a different variable, like $i, instead. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 19, 2006 at 01:00 UTC 86291555c94300b057a156d87239a6cab09511b3
1 file changed +8 -6
git-gui
+8 -6
@@ -369,13 +369,14 @@ proc read_diff_index {fd after} {
369 if {$z2 == -1} break
370
371 incr c
372 - set n [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
372 + set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
373 merge_state \
374 [string range $buf_rdi $z1 [expr {$z2 - 1}]] \
375 - [lindex $n 4]? \
376 - [list [lindex $n 0] [lindex $n 2]] \
375 + [lindex $i 4]? \
376 + [list [lindex $i 0] [lindex $i 2]] \
377 [list]
378 set c $z2
379 + incr c
380 }
381 if {$c < $n} {
382 set buf_rdi [string range $buf_rdi $c end]
@@ -400,13 +401,14 @@ proc read_diff_files {fd after} {
401 if {$z2 == -1} break
402
403 incr c
403 - set n [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
404 + set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
405 merge_state \
406 [string range $buf_rdf $z1 [expr {$z2 - 1}]] \
406 - ?[lindex $n 4] \
407 + ?[lindex $i 4] \
408 [list] \
408 - [list [lindex $n 0] [lindex $n 2]]
409 + [list [lindex $i 0] [lindex $i 2]]
410 set c $z2
411 + incr c
412 }
413 if {$c < $n} {
414 set buf_rdf [string range $buf_rdf $c end]