summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLibravatar Alexander Gavrilov <angavrilov@gmail.com>2008-09-30 12:12:16 +0400
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2008-09-30 11:47:33 -0700
commit0aea2842d9d556afa4a3e8120e465479ad7368ca (patch)
tree1e0a0bfa8bb6897e45e5b9a30fc10ce8b3d19a75 /lib
parentgit-gui: Do not automatically stage file after merge tool finishes (diff)
downloadtgif-0aea2842d9d556afa4a3e8120e465479ad7368ca.tar.xz
git-gui: Make Ctrl-T safe to use for conflicting files.
A previous patch added a check for conflict markers, which is done when the file is about to be staged due to a click on the icon. However, pressing Ctrl-T still immediately stages the file without confirmation. This patch fixes it. The check requires a loaded diff, so staging multiple files at once won't work if they are unmerged. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/index.tcl11
-rw-r--r--lib/merge.tcl1
-rw-r--r--lib/mergetool.tcl7
3 files changed, 14 insertions, 5 deletions
diff --git a/lib/index.tcl b/lib/index.tcl
index b045219a1c..d33896a0ce 100644
--- a/lib/index.tcl
+++ b/lib/index.tcl
@@ -298,11 +298,18 @@ proc add_helper {txt paths} {
set after {}
foreach path $paths {
switch -glob -- [lindex $file_states($path) 0] {
+ _U -
+ U? {
+ if {$path eq $current_diff_path} {
+ unlock_index
+ merge_stage_workdir $path
+ return
+ }
+ }
_O -
?M -
?D -
- ?T -
- U? {
+ ?T {
lappend pathList $path
if {$path eq $current_diff_path} {
set after {reshow_diff;}
diff --git a/lib/merge.tcl b/lib/merge.tcl
index 5c01875b05..ac4c7ded14 100644
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
@@ -40,6 +40,7 @@ The rescan will be automatically started now.
_O {
continue; # and pray it works!
}
+ _U
U? {
error_popup [mc "You are in the middle of a conflicted merge.
diff --git a/lib/mergetool.tcl b/lib/mergetool.tcl
index 8d1ee5b11d..eb2b4b56a4 100644
--- a/lib/mergetool.tcl
+++ b/lib/mergetool.tcl
@@ -23,13 +23,14 @@ This operation can be undone only by restarting the merge." \
}
}
-proc merge_stage_workdir {path w lno} {
+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} {
- show_diff $path $w $lno {} [list do_merge_stage_workdir $path]
+ 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
}