diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2008-09-20 12:19:18 +0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-09-24 12:51:43 -0700 |
commit | 3e34838caf796e67c057a136d1fdfe1d4286a003 (patch) | |
tree | 2ee7832031889e8ca002f3d1ca680ac32b835852 /git-gui.sh | |
parent | 6fc835a3f36146006bb33362368cf9d314877e51 (diff) | |
download | git-3e34838caf796e67c057a136d1fdfe1d4286a003.tar.gz |
git-gui: Reenable staging unmerged files by clicking the icon.
This restores functionality of the file icon for unmerged files.
Safety is enforced by loading the diff and checking for lines
that look like conflict markers. If such lines are found, or
the conflict involves deletion and/or symlinks, a confirmation
dialog is presented. Otherwise, the icon immediately stages the
working copy version of the file.
Includes a revert of 2fe5b2ee42897a3acc78e5ddaace3775eb2713ca
(Restore ability to Stage Working Copy for conflicts)
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-x | git-gui.sh | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/git-gui.sh b/git-gui.sh index 03c450d73f..4085e8fea5 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1059,6 +1059,7 @@ set current_branch {} set is_detached 0 set current_diff_path {} set is_3way_diff 0 +set is_conflict_diff 0 set selected_commit_type new set nullid "0000000000000000000000000000000000000000" @@ -2078,19 +2079,21 @@ 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 + # Determine the state of the file if {[info exists file_states($path)]} { set state [lindex $file_states($path) 0] } else { set state {__} } - if {[string first {U} $state] >= 0} { - set col 1 - } - # Restage the file, or simply show the diff if {$col == 0 && $y > 1} { + # Conflicts need special handling + if {[string first {U} $state] >= 0} { + merge_stage_workdir $path $w $lno + return + } + if {[string index $state 1] eq {O}} { set mmask {} } else { @@ -3057,11 +3060,6 @@ $ctxmmg add command \ -command {merge_resolve_one 1} lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state] $ctxmmg add separator -$ctxmmg add command \ - -label [mc "Stage Working Copy"] \ - -command {merge_resolve_one 0} -lappend diff_actions [list $ctxmmg entryconf [$ctxmmg index last] -state] -$ctxmmg add separator create_common_diff_popup $ctxmmg proc popup_diff_menu {ctxm ctxmmg x y X Y} { |