diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-07-13 11:24:16 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-13 11:24:17 -0700 |
commit | 5eb1e9f1a0df41cfc6a75cef9c2f11460a6da8dc (patch) | |
tree | 279d8fae60071fc11dbf92e4cc32a9f69acebb65 | |
parent | 6c35952a081ad897643d4d23615ccc429c924a39 (diff) | |
parent | 33ba9c648b6753a4184e53ffb89f0a924f9f7b7e (diff) | |
download | git-5eb1e9f1a0df41cfc6a75cef9c2f11460a6da8dc.tar.gz git-5eb1e9f1a0df41cfc6a75cef9c2f11460a6da8dc.tar.xz |
Merge branch 'ps/rebase-i-auto-unstash-upon-abort'
"git rebase -i --autostash" did not restore the auto-stashed change
when the operation was aborted.
* ps/rebase-i-auto-unstash-upon-abort:
rebase -i: restore autostash on abort
-rw-r--r-- | git-rebase--interactive.sh | 1 | ||||
-rwxr-xr-x | t/t3420-rebase-autostash.sh | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 068b16722..ded459563 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -212,6 +212,7 @@ Once you are satisfied with your changes, run } die_abort () { + apply_autostash rm -rf "$state_dir" die "$1" } diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh index 944154b2e..532ff5cbd 100755 --- a/t/t3420-rebase-autostash.sh +++ b/t/t3420-rebase-autostash.sh @@ -192,4 +192,35 @@ test_expect_success 'abort rebase -i with --autostash' ' test_cmp expected file0 ' +test_expect_success 'restore autostash on editor failure' ' + test_when_finished "git reset --hard" && + echo uncommitted-content >file0 && + ( + test_set_editor "false" && + test_must_fail git rebase -i --autostash HEAD^ + ) && + echo uncommitted-content >expected && + test_cmp expected file0 +' + +test_expect_success 'autostash is saved on editor failure with conflict' ' + test_when_finished "git reset --hard" && + echo uncommitted-content >file0 && + ( + write_script abort-editor.sh <<-\EOF && + echo conflicting-content >file0 + exit 1 + EOF + test_set_editor "$(pwd)/abort-editor.sh" && + test_must_fail git rebase -i --autostash HEAD^ && + rm -f abort-editor.sh + ) && + echo conflicting-content >expected && + test_cmp expected file0 && + git checkout file0 && + git stash pop && + echo uncommitted-content >expected && + test_cmp expected file0 +' + test_done |