All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Neal Kreitzinger" <neal@rsss.com>
To: git@vger.kernel.org
Subject: interactive rebase "reword" runs pre-commit hook but ignores non-zero exit status
Date: Wed, 8 Sep 2010 19:26:58 -0500	[thread overview]
Message-ID: <i699mo$8jd$1@dough.gmane.org> (raw)

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

                 reply	other threads:[~2010-09-09  0:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='i699mo$8jd$1@dough.gmane.org' \
    --to=neal@rsss.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.