Skip to content

Commit 124355d

Browse files
committed
git-gui: Always start a rescan on an empty diff.
If we got an empty diff its probably because the modification time of the file was changed but the file content hasn't been changed. Typically this happens because an outside program modified the file and git-gui was told to not run 'update-index --refresh', as the user generally trusts file modification timestamps. But we can also get an empty diff when a program undos a file change and still updates the modification timestamp upon saving, but has undone the file back to the same as what is in the index or in PARENT. So even if gui.trustmtime is false we should still run a rescan on an empty diff. This change also lets us cleanup the dialog message that we show when this case occurs, as its no longer got anything to do with Trust File Modification Timestamps. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent e54a1bd commit 124355d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

git-gui.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -582,11 +582,11 @@ proc handle_empty_diff {} {
582582
[short_path $path] has no changes.
583583
584584
The modification date of this file was updated
585-
by another application and you currently have
586-
the Trust File Modification Timestamps option
587-
enabled, so Git did not automatically detect
588-
that there are no content differences in this
589-
file."
585+
by another application, but the content within
586+
the file was not changed.
587+
588+
A rescan will be automatically started to find
589+
other files which may have the same state."
590590

591591
clear_diff
592592
display_file $path __
@@ -683,7 +683,6 @@ proc show_diff {path w {lno {}}} {
683683

684684
proc read_diff {fd} {
685685
global ui_diff ui_status_value is_3way_diff diff_active
686-
global repo_config
687686

688687
$ui_diff conf -state normal
689688
while {[gets $fd line] >= 0} {
@@ -763,8 +762,7 @@ proc read_diff {fd} {
763762
unlock_index
764763
set ui_status_value {Ready.}
765764

766-
if {$repo_config(gui.trustmtime) eq {true}
767-
&& [$ui_diff index end] eq {2.0}} {
765+
if {[$ui_diff index end] eq {2.0}} {
768766
handle_empty_diff
769767
}
770768
}

0 commit comments

Comments
 (0)