Merge branch 'aw/rebase-i-stop-on-failure-to-amend'

* aw/rebase-i-stop-on-failure-to-amend:
  rebase -i: interrupt rebase when "commit --amend" failed during "reword"
This commit is contained in:
Junio C Hamano 2011-12-16 22:33:37 -08:00
Родитель e9bba5340e 0becb3e4b9
Коммит e45c9b03c3
1 изменённых файлов: 23 добавлений и 13 удалений

Просмотреть файл

@ -143,6 +143,21 @@ die_with_patch () {
die "$2" die "$2"
} }
exit_with_patch () {
echo "$1" > "$state_dir"/stopped-sha
make_patch $1
git rev-parse --verify HEAD > "$amend"
warn "You can amend the commit now, with"
warn
warn " git commit --amend"
warn
warn "Once you are satisfied with your changes, run"
warn
warn " git rebase --continue"
warn
exit $2
}
die_abort () { die_abort () {
rm -rf "$state_dir" rm -rf "$state_dir"
die "$1" die "$1"
@ -408,7 +423,13 @@ do_next () {
mark_action_done mark_action_done
pick_one $sha1 || pick_one $sha1 ||
die_with_patch $sha1 "Could not apply $sha1... $rest" die_with_patch $sha1 "Could not apply $sha1... $rest"
git commit --amend --no-post-rewrite git commit --amend --no-post-rewrite || {
warn "Could not amend commit after successfully picking $sha1... $rest"
warn "This is most likely due to an empty commit message, or the pre-commit hook"
warn "failed. If the pre-commit hook failed, you may need to resolve the issue before"
warn "you are able to reword the commit."
exit_with_patch $sha1 1
}
record_in_rewritten $sha1 record_in_rewritten $sha1
;; ;;
edit|e) edit|e)
@ -417,19 +438,8 @@ do_next () {
mark_action_done mark_action_done
pick_one $sha1 || pick_one $sha1 ||
die_with_patch $sha1 "Could not apply $sha1... $rest" die_with_patch $sha1 "Could not apply $sha1... $rest"
echo "$sha1" > "$state_dir"/stopped-sha
make_patch $sha1
git rev-parse --verify HEAD > "$amend"
warn "Stopped at $sha1... $rest" warn "Stopped at $sha1... $rest"
warn "You can amend the commit now, with" exit_with_patch $sha1 0
warn
warn " git commit --amend"
warn
warn "Once you are satisfied with your changes, run"
warn
warn " git rebase --continue"
warn
exit 0
;; ;;
squash|s|fixup|f) squash|s|fixup|f)
case "$command" in case "$command" in