summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d3bcf55)
raw | patch | inline | side by side (parent: d3bcf55)
author | Alexander Gavrilov <angavrilov@gmail.com> | |
Tue, 30 Sep 2008 08:12:16 +0000 (12:12 +0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 30 Sep 2008 18:47:33 +0000 (11:47 -0700) |
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>
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>
git-gui.sh | patch | blob | history | |
lib/index.tcl | patch | blob | history | |
lib/merge.tcl | patch | blob | history | |
lib/mergetool.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 09ce4101f12741679070cad7ccadf7ee191f86bc..4d52f02dcec076d2d1af1c2e542068dbe2fcffde 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
if {$col == 0 && $y > 1} {
# Conflicts need special handling
if {[string first {U} $state] >= 0} {
- merge_stage_workdir $path $w $lno
+ # $w must always be $ui_workdir, but...
+ if {$w ne $ui_workdir} { set lno {} }
+ merge_stage_workdir $path $lno
return
}
diff --git a/lib/index.tcl b/lib/index.tcl
index b045219a1cca6bf46218bf211c0c88b8d699e144..d33896a0ce26dd34c8024e21c71123e62832b8c0 100644 (file)
--- a/lib/index.tcl
+++ b/lib/index.tcl
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 5c01875b051305b5b40a17ac7a2245f69081f41b..ac4c7ded14ad485d62a1381c6c40ed4f32a748b9 100644 (file)
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
_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 8d1ee5b11d01496c608d639845b680c42dc8a0ef..eb2b4b56a4db4c20727432c7a71d5192d580ce9e 100644 (file)
--- a/lib/mergetool.tcl
+++ b/lib/mergetool.tcl
}
}
-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
}