aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2008-08-31 00:54:19 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-09-04 21:28:55 -0700
commit617ceee653bd7377f662bfc6d3085f321efab7e4 (patch)
treea24b3050c26321f93bacc8493b8e1c3757cf53d4
parent7e30682ce042fdea1ff2c76226b17d9affe2f9bf (diff)
downloadgit-617ceee653bd7377f662bfc6d3085f321efab7e4.tar.gz
git-617ceee653bd7377f662bfc6d3085f321efab7e4.tar.xz
git-gui: Don't allow staging files with conflicts.
Prevent staging files with conflict markers by clicking on the icon in the 'Unstaged Changes' list. Instead, pretend that the user clicked the name, and show the diff. Originally it made some sense to allow staging conflicting files, because git-gui did not provide any tools to resolve them from within the GUI. But now that we have added mergetool capabilities, it is more likely to cause accidental and non-undoable errors. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-xgit-gui.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 677a27150..061fac768 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1840,6 +1840,14 @@ proc toggle_or_diff {w x y} {
$ui_index tag remove in_sel 0.0 end
$ui_workdir tag remove in_sel 0.0 end
+ # Do not stage files with conflicts
+ if {[info exists file_states($path)]} {
+ set state [lindex $file_states($path) 0]
+ if {[string index $state 0] eq {U}} {
+ set col 1
+ }
+ }
+
if {$col == 0 && $y > 1} {
set i [expr {$lno-1}]
set ll [expr {[llength $file_lists($w)]-1}]