git-gui: Fix fetching from remotes when adding them
[gitweb.git] / lib / mergetool.tcl
index a44a7258bccc5bffea21b470eb297b02f0ad97af..eb2b4b56a4db4c20727432c7a71d5192d580ce9e 100644 (file)
@@ -5,12 +5,6 @@ proc merge_resolve_one {stage} {
        global current_diff_path
 
        switch -- $stage {
-               0 {     # Stage without confirmation, to minimize
-                       # disruption of the rerere workflow
-                       merge_add_resolution $current_diff_path
-                       return
-               }
-
                1 { set targetquestion [mc "Force resolution to the base version?"] }
                2 { set targetquestion [mc "Force resolution to this branch?"] }
                3 { set targetquestion [mc "Force resolution to the other branch?"] }
@@ -29,6 +23,34 @@ This operation can be undone only by restarting the merge." \
        }
 }
 
+proc merge_stage_workdir {path {lno {}}} {
+       global current_diff_path diff_active
+       global current_diff_side ui_workdir
+
+       if {$diff_active} return
+
+       if {$path ne $current_diff_path || $ui_workdir ne $current_diff_side} {
+               show_diff $path $ui_workdir $lno {} [list do_merge_stage_workdir $path]
+       } else {
+               do_merge_stage_workdir $path
+       }
+}
+
+proc do_merge_stage_workdir {path} {
+       global current_diff_path is_conflict_diff
+
+       if {$path ne $current_diff_path} return;
+
+       if {$is_conflict_diff} {
+               if {[ask_popup [mc "File %s seems to have unresolved conflicts, still stage?" \
+                               [short_path $path]]] ne {yes}} {
+                       return
+               }
+       }
+
+       merge_add_resolution $path
+}
+
 proc merge_add_resolution {path} {
        global current_diff_path ui_workdir
 
@@ -354,14 +376,6 @@ proc merge_tool_finish {fd} {
                }
        }
 
-       # Check the modification time of the target file
-       if {!$failed && [file mtime $mtool_target] eq $mtool_mtime} {
-               if {[ask_popup [mc "File %s unchanged, still accept as resolved?" \
-                               [short_path $mtool_target]]] ne {yes}} {
-                       set failed 1
-               }
-       }
-
        # Finish
        if {$failed} {
                file rename -force -- $backup $mtool_target
@@ -374,6 +388,6 @@ proc merge_tool_finish {fd} {
 
                delete_temp_files $mtool_tmpfiles
 
-               merge_add_resolution $mtool_target
+               reshow_diff
        }
 }