@matheusbsbs / matheus-bagliano / commits / 079d0d5057
Fork 0

git-gui: Fix bug in unmerged file display.

We were not correctly setting the old state of an index display to _ if the index was previously unmerged. This caused us to try and update a U->M when resolving a merge conflict but we were unable to do so as the icon did not exist in the index viewer. Tk did not like being asked to modify an icon which was undefined. Now we always transform both the old and the new states for both sides (index and working directory) prior to updating the UI. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jan 21, 2007 at 13:18 UTC 079d0d5057dd66916c8d23802d48b19235fedf09
1 file changed +16 -9
git-gui.sh
+16 -9
@@ -1320,20 +1320,27 @@ proc display_file {path state} {
1320 set new_m [lindex $s 0]
1321 set icon_name [lindex $s 1]
1322
1323 - set s [string index $new_m 0]
1324 - if {$s eq {U}} {
1325 - set s _
1323 + set o [string index $old_m 0]
1324 + set n [string index $new_m 0]
1325 + if {$o eq {U}} {
1326 + set o _
1327 }
1327 - display_file_helper $ui_index $path $icon_name \
1328 - [string index $old_m 0] $s
1328 + if {$n eq {U}} {
1329 + set n _
1330 + }
1331 + display_file_helper $ui_index $path $icon_name $o $n
1332
1333 + if {[string index $old_m 0] eq {U}} {
1334 + set o U
1335 + } else {
1336 + set o [string index $old_m 0]
1337 + }
1338 if {[string index $new_m 0] eq {U}} {
1331 - set s U
1339 + set n U
1340 } else {
1333 - set s [string index $new_m 1]
1341 + set n [string index $new_m 1]
1342 }
1335 - display_file_helper $ui_workdir $path $icon_name \
1336 - [string index $old_m 1] $s
1343 + display_file_helper $ui_workdir $path $icon_name $o $n
1344
1345 if {$new_m eq {__}} {
1346 unset file_states($path)