Skip to contentSkip to conversation

rebase -i reword converts to pick on pre-commit non-zero exit

DISCUSSION Neal Kreitzinger 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

When interactive rebase does the reword command it runs the pre-commit hook for that commit (a). If the pre-commit hook gives a non-zero exit then interactive rebase picks commit (a) and continues to the next commit (b) in the rebase-to-do-list. Instead of picking commit (a) when the pre-commit hook exits non-zero on the reword command, shouldn't interactive rebase learn to edit commit (a) and tell the user that because the pre-commit hook exited non-zero they need to either remedy the pre-commit hook violations and run git commit --amend or run git commit --amend --no-verify to bypass the pre-commit hook? Otherwise, you have to run another rebase after the rejected rewords and edit those commits to accomplish the rewords.

v/r,
neal

#1 lore raw
Quoted 11 lines · Neal Kreitzinger

When interactive rebase does the reword command it runs the pre-commit hook for that commit (a). If the pre-commit hook gives a non-zero exit then interactive rebase picks commit (a) and continues to the next commit (b) in the rebase-to-do-list. Instead of picking commit (a) when the pre-commit hook exits non-zero on the reword command, shouldn't interactive rebase learn to edit commit (a) and tell the user that because the pre-commit hook exited non-zero they need to either remedy the pre-commit hook violations and run git commit --amend or run git commit --amend --no-verify to bypass the pre-commit hook? Otherwise, you have to run another rebase after the rejected rewords and edit those commits to accomplish the rewords.

git 1.7.1

v/r,
neal

#2 lore raw
Quoted 6 lines · Neal Kreitzinger

Instead of picking commit (a) when the pre-commit
hook exits non-zero on the reword command, shouldn't interactive rebase learn to edit commit (a) and tell the user that because the pre-commit hook exited non-zero they need to either remedy the pre-commit hook violations and run git commit --amend or run git commit --amend --no-verify to bypass the pre-commit hook?

Yup, I've submitted a patch to address this issue a while ago. This new behavior should be in v.1.7.8.2 and later.

#3 lore raw
Quoted 10 lines · Andrew Wong
Quoted 6 lines · Neal Kreitzinger

Instead of picking commit (a) when the pre-commit hook exits non-zero on the reword command, shouldn't interactive rebase learn to edit commit (a) and tell the user that because the pre-commit hook exited non-zero they need to either remedy the pre-commit hook violations and run git commit --amend or run git commit --amend --no-verify to bypass the pre-commit hook?

Yup, I've submitted a patch to address this issue a while ago. This new behavior should be in v.1.7.8.2 and later.

I now see that this 1.7.8.2 release note applies:

* When a "reword" action in "git rebase -i" failed to run "commit
--amend",
we did not give the control back to the user to resolve the
situation, and
instead kept the original commit log message.

thanks!

v/r,
neal