File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -1049,14 +1049,14 @@ fi
10491049
10501050
10511051has_action " $todo " ||
1052- die_abort " Nothing to do "
1052+ return 2
10531053
10541054cp " $todo " " $todo " .backup
10551055git_sequence_editor " $todo " ||
10561056 die_abort " Could not execute editor"
10571057
10581058has_action " $todo " ||
1059- die_abort " Nothing to do "
1059+ return 2
10601060
10611061expand_todo_ids
10621062
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ move_to_original_branch () {
155155 esac
156156}
157157
158- finish_rebase () {
158+ apply_autostash () {
159159 if test -f " $state_dir /autostash"
160160 then
161161 stash_sha1=$( cat " $state_dir /autostash" )
@@ -171,6 +171,10 @@ You can run "git stash pop" or "git stash drop" at any time.
171171'
172172 fi
173173 fi
174+ }
175+
176+ finish_rebase () {
177+ apply_autostash &&
174178 git gc --auto &&
175179 rm -rf " $state_dir "
176180}
@@ -186,6 +190,11 @@ run_specific_rebase () {
186190 if test $ret -eq 0
187191 then
188192 finish_rebase
193+ elif test $ret -eq 2 # special exit status for rebase -i
194+ then
195+ apply_autostash &&
196+ rm -rf " $state_dir " &&
197+ die " Nothing to do"
189198 fi
190199 exit $ret
191200}
Original file line number Diff line number Diff line change @@ -167,4 +167,19 @@ testrebase "" .git/rebase-apply
167167testrebase " --merge" .git/rebase-merge
168168testrebase " --interactive" .git/rebase-merge
169169
170+ test_expect_success ' abort rebase -i with --autostash' '
171+ test_when_finished "git reset --hard" &&
172+ echo uncommited-content >file0 &&
173+ (
174+ write_script abort-editor.sh <<-\EOF &&
175+ echo >"$1"
176+ EOF
177+ test_set_editor "$(pwd)/abort-editor.sh" &&
178+ test_must_fail git rebase -i --autostash HEAD^ &&
179+ rm -f abort-editor.sh
180+ ) &&
181+ echo uncommited-content >expected &&
182+ test_cmp expected file0
183+ '
184+
170185test_done
You can’t perform that action at this time.
0 commit comments