@@ -143,6 +143,21 @@ die_with_patch () {
143
143
die " $2 "
144
144
}
145
145
146
+ exit_with_patch () {
147
+ echo " $1 " > " $state_dir " /stopped-sha
148
+ make_patch $1
149
+ git rev-parse --verify HEAD > " $amend "
150
+ warn " You can amend the commit now, with"
151
+ warn
152
+ warn " git commit --amend"
153
+ warn
154
+ warn " Once you are satisfied with your changes, run"
155
+ warn
156
+ warn " git rebase --continue"
157
+ warn
158
+ exit $2
159
+ }
160
+
146
161
die_abort () {
147
162
rm -rf " $state_dir "
148
163
die " $1 "
@@ -408,7 +423,13 @@ do_next () {
408
423
mark_action_done
409
424
pick_one $sha1 ||
410
425
die_with_patch $sha1 " Could not apply $sha1 ... $rest "
411
- git commit --amend --no-post-rewrite
426
+ git commit --amend --no-post-rewrite || {
427
+ warn " Could not amend commit after successfully picking $sha1 ... $rest "
428
+ warn " This is most likely due to an empty commit message, or the pre-commit hook"
429
+ warn " failed. If the pre-commit hook failed, you may need to resolve the issue before"
430
+ warn " you are able to reword the commit."
431
+ exit_with_patch $sha1 1
432
+ }
412
433
record_in_rewritten $sha1
413
434
;;
414
435
edit|e)
@@ -417,19 +438,8 @@ do_next () {
417
438
mark_action_done
418
439
pick_one $sha1 ||
419
440
die_with_patch $sha1 " Could not apply $sha1 ... $rest "
420
- echo " $sha1 " > " $state_dir " /stopped-sha
421
- make_patch $sha1
422
- git rev-parse --verify HEAD > " $amend "
423
441
warn " Stopped at $sha1 ... $rest "
424
- warn " You can amend the commit now, with"
425
- warn
426
- warn " git commit --amend"
427
- warn
428
- warn " Once you are satisfied with your changes, run"
429
- warn
430
- warn " git rebase --continue"
431
- warn
432
- exit 0
442
+ exit_with_patch $sha1 0
433
443
;;
434
444
squash|s|fixup|f)
435
445
case " $command " in
0 commit comments