git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* interactive rebase "reword" runs pre-commit hook but ignores non-zero exit status
@ 2010-09-09  0:26 Neal Kreitzinger
  0 siblings, 0 replies; only message in thread
From: Neal Kreitzinger @ 2010-09-09  0:26 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-09  0:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-09  0:26 interactive rebase "reword" runs pre-commit hook but ignores non-zero exit status Neal Kreitzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).