interactive rebase "reword" runs pre-commit hook but ignores non-zero exit status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've isolated what seems to be a loophole in interactive rebase by rebasing 
a branch for the sole purpose of rewording some commits:

(I just finished performing a rebase for the sole purpose of squashing 
several commits into 2 commits)
(Now I want to reword those 2 commits)

$ git --version = 1.7.1
$ git rebase -i --onto BranchA~2 BranchA~2 BranchA
(change "pick" to "reword" in rebase-stack editor)
reword Abbrsha1 some-commit-message
reword Bbbrsha1 some-other-commit-message
# Rebase Cbbrsha1..Dbbrsha1 onto Cbbrsha1
(save changes in editor)
".git/rebase-merge/git-rebase-todo" 15L, 580C written
(shows output from pre-commit hook and the corresponding non-zero exit)
Start of pre-commit hook...
checking for something I don't like...
ERROR: I found something I don't like!
Commit Aborted!
Start of pre-commit hook...
checking for something I don't like...
ERROR: I found something I don't like!
Commit Aborted!
Successfully rebased and updated refs/heads/BranchA.
$ _

In this case, the thing that caused the pre-commit to error-out was that the 
format of a report that it runs was changed.  So in this case, I will 
rebase -i and "edit" the commits and git-add the new report format so the 
pre-commit doesn't complain.  However, I originally tried to do the reword 
and squash in a single rebase and it gave the same errors, but performed the 
squashes.  Is this the intended behavior?  On the one hand, you shouldn't be 
changing content in a "reword", but on the other hand if you're going to run 
the pre-commit hook then shouldn't you abort the rebase if the pre-commit 
hook exits with non-zero status?

I admit that a workflow in which content changes on a reword may not be a 
valid scenario that you should care about in your rebase exception handling, 
but shouldn't you care that the pre-commit hook exited with non-zero status 
regardless of the reason why it exited with non-zero status?  Just a 
question.

v/r,
Neal



--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]