From: Alexander Gavrilov <angavrilov@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
Johannes Sixt <j.sixt@viscovery.net>
Subject: [PATCH (GIT-GUI)] git-gui: Make Ctrl-T safe to use for conflicting files.
Date: Tue, 30 Sep 2008 12:12:16 +0400 [thread overview]
Message-ID: <200809301212.17080.angavrilov@gmail.com> (raw)
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>
---
git-gui.sh | 4 +++-
lib/index.tcl | 11 +++++++++--
lib/merge.tcl | 1 +
lib/mergetool.tcl | 7 ++++---
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index 4085e8f..717817e 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2090,7 +2090,9 @@ proc toggle_or_diff {w x y} {
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 b045219..d33896a 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 5c01875..ac4c7de 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 6ab5701..1984c64 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
}
--
1.6.0.20.g6148bc
reply other threads:[~2008-09-30 8:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200809301212.17080.angavrilov@gmail.com \
--to=angavrilov@gmail.com \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).