@matheusbsbs / matheus-bagliano / commits / 2cbe5577a0
Fork 0

git-gui: Reshow diff if we sent the file to update-index.

We can't ask the diff viewer to recompute the diff until after our update-index child process terminates, as the diff programs need to be able to read the updated index in order to generate the correct diff. This is actually why we prevent diffs from being generated while there is an update lock on the index, which is why we ignored our own show_diff invocation in the middle of the write_update_index event handler. So now we mark a flag if we identify that the file currently in the diff viewer was also sent to update-index; then later when the update-index process has terminated we update the diff viewer if the flag is true. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 12, 2006 at 18:22 UTC 2cbe5577a0e83ae7368eb2202ffe62c1d607b0bb
1 file changed +9 -4
git-gui
+9 -4
@@ -1143,11 +1143,12 @@ proc display_all_files {} {
1143 }
1144
1145 proc update_index {pathList} {
1146 - global update_index_cp ui_status_value
1146 + global update_index_cp update_index_rsd ui_status_value
1147
1148 if {![lock_index update]} return
1149
1150 set update_index_cp 0
1151 + set update_index_rsd 0
1152 set totalCnt [llength $pathList]
1153 set batch [expr {int($totalCnt * .01) + 1}]
1154 if {$batch > 25} {set batch 25}
@@ -1170,13 +1171,17 @@ proc update_index {pathList} {
1171 }
1172
1173 proc write_update_index {fd pathList totalCnt batch} {
1173 - global update_index_cp ui_status_value
1174 + global update_index_cp update_index_rsd ui_status_value
1175 global file_states ui_fname_value
1176
1177 if {$update_index_cp >= $totalCnt} {
1178 close $fd
1179 unlock_index
1179 - set ui_status_value {Ready.}
1180 + if {$update_index_rsd} {
1181 + show_diff $ui_fname_value
1182 + } else {
1183 + set ui_status_value {Ready.}
1184 + }
1185 return
1186 }
1187
@@ -1200,7 +1205,7 @@ proc write_update_index {fd pathList totalCnt batch} {
1205 puts -nonewline $fd "\0"
1206 display_file $path $new
1207 if {$ui_fname_value eq $path} {
1203 - show_diff $path
1208 + set update_index_rsd 1
1209 }
1210 }
1211