summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-20 23:20:17 -0500
committerShawn O. Pearce <spearce@spearce.org>2007-01-21 02:54:23 -0500
commit7d40edfa06adf7f31f787bb6379c1eb454242c19 (patch)
tree0cb2211883131baa8014e852bdd2df65594fd61c
parentde5f6d5d178a1c8113aaca34c8f6b3842732a741 (diff)
downloadgit-7d40edfa06adf7f31f787bb6379c1eb454242c19.tar.xz
git-gui: Refactor the revert (aka checkout-index) implementation.
We can revert any file which has a valid stage 0 (is not unmerged) and which is has a working directory status of M or D. This vastly simplifies our pattern matching on file status when building up the list of files to perform a checkout-index against. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-xgit-gui.sh27
1 files changed, 9 insertions, 18 deletions
diff --git a/git-gui.sh b/git-gui.sh
index c1ee48bf07..7bd2b87fe3 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1597,20 +1597,14 @@ proc write_checkout_index {fd pathList totalCnt batch msg after} {
{incr i -1} {
set path [lindex $pathList $update_index_cp]
incr update_index_cp
-
switch -glob -- [lindex $file_states($path) 0] {
- AM -
- AD {set new A_}
- MM -
- MD {set new M_}
- _M -
- _D {set new __}
- ?? {continue}
+ U? {continue}
+ ?M -
+ ?D {
+ puts -nonewline $fd "$path\0"
+ display_file $path ?_
+ }
}
-
- puts -nonewline $fd $path
- puts -nonewline $fd "\0"
- display_file $path $new
}
set ui_status_value [format \
@@ -2406,12 +2400,9 @@ proc revert_helper {txt paths} {
set after {}
foreach path $paths {
switch -glob -- [lindex $file_states($path) 0] {
- AM -
- AD -
- MM -
- MD -
- _M -
- _D {
+ U? {continue}
+ ?M -
+ ?D {
lappend pathList $path
if {$path eq $current_diff} {
set after {reshow_diff;}