summaryrefslogtreecommitdiff
path: root/git-rebase.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-25 11:49:31 -0700
committerJunio C Hamano <gitster@pobox.com>2014-06-25 11:49:31 -0700
commitd9036cd28c9b115fe38e2f629292f2ddf60fb805 (patch)
tree3bfea3d65784d1719a86e5d86814ff6a9d81dc9a /git-rebase.sh
parent8675779454ed3007bd2a8f83d013e05a65c2d480 (diff)
parentddb5432d2390e1957e473618009ba3d2fbbf29a7 (diff)
downloadgit-d9036cd28c9b115fe38e2f629292f2ddf60fb805.tar.gz
Merge branch 'rr/rebase-autostash-fix' into maint
The autostash mode of "git rebase -i" did not restore the dirty working tree state if the user aborted the interactive rebase by emptying the insn sheet. * rr/rebase-autostash-fix: rebase -i: test "Nothing to do" case with autostash rebase -i: handle "Nothing to do" case with autostash
Diffstat (limited to 'git-rebase.sh')
-rwxr-xr-xgit-rebase.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index 4543815ffd..47ca3b990b 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -155,7 +155,7 @@ move_to_original_branch () {
esac
}
-finish_rebase () {
+apply_autostash () {
if test -f "$state_dir/autostash"
then
stash_sha1=$(cat "$state_dir/autostash")
@@ -171,6 +171,10 @@ You can run "git stash pop" or "git stash drop" at any time.
'
fi
fi
+}
+
+finish_rebase () {
+ apply_autostash &&
git gc --auto &&
rm -rf "$state_dir"
}
@@ -186,6 +190,11 @@ run_specific_rebase () {
if test $ret -eq 0
then
finish_rebase
+ elif test $ret -eq 2 # special exit status for rebase -i
+ then
+ apply_autostash &&
+ rm -rf "$state_dir" &&
+ die "Nothing to do"
fi
exit $ret
}