summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-07-28 18:25:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-28 18:25:52 (GMT)
commitae8daba6019fba266ba7afd88aa642bf6994fe2c (patch)
tree58982f686dd4612a537d3757bdec7df844c05ef0 /t
parentc12c71fabb3598a480111a31c151bc787cdced30 (diff)
parent33ba9c648b6753a4184e53ffb89f0a924f9f7b7e (diff)
downloadgit-ae8daba6019fba266ba7afd88aa642bf6994fe2c.zip
git-ae8daba6019fba266ba7afd88aa642bf6994fe2c.tar.gz
git-ae8daba6019fba266ba7afd88aa642bf6994fe2c.tar.bz2
Merge branch 'ps/rebase-i-auto-unstash-upon-abort' into maint
"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
Diffstat (limited to 't')
-rwxr-xr-xt/t3420-rebase-autostash.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 944154b..532ff5c 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