Andrew Wong <andrew.kw.w@xxxxxxxxx> writes: > "commit --amend" could fail in cases like the user empties the commit > message, or pre-commit failed. When it fails, rebase should be > interrupted, rather than ignoring the error and continue on rebasing. > This gives users a way to gracefully interrupt a "reword" if they > decided they actually want to do an "edit", or even "rebase --abort". > > Signed-off-by: Andrew Wong <andrew.kw.w@xxxxxxxxx> Makes sense, especially if "commit" itself failed due to some unknown reason or a refusal from the pre-commit hook. Even though a user could have been using the "empty the commit log message and the original is kept" as a trick to recover from a botched rewording attempt and this change will regress for such use cases, I have a feeling that it does not matter. Is there anything we should be saying more than "fatal: Cannot amend" to help users when this new "die" triggers? What is the recommended recovery procedure? Run "git commit --amend" after doing whatever is needed to fix the tree (e.g. if pre-commit refused because of a coding style violation, it may involve fixing the tree being committed; if it refused because of a typo in the log message, the tree itself may be OK and nothing needs to be done) and then "git rebase --continue"? > git-rebase--interactive.sh | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh > index 804001b..669f378 100644 > --- a/git-rebase--interactive.sh > +++ b/git-rebase--interactive.sh > @@ -408,7 +408,8 @@ do_next () { > mark_action_done > pick_one $sha1 || > die_with_patch $sha1 "Could not apply $sha1... $rest" > - git commit --amend --no-post-rewrite > + git commit --amend --no-post-rewrite || > + die_with_patch $sha1 "Cannot amend commit after successfully picking $sha1... $rest" > record_in_rewritten $sha1 > ;; > edit|e) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html