[Insight-developers] Which hook is really stopping me to commit and why?

Brad King brad.king at kitware.com
Tue Jan 11 18:16:36 EST 2011


On 01/11/2011 06:04 PM, Arnaud GELAS wrote:
> + .git/hooks/gerrit/commit-msg .git/COMMIT_EDITMSG
> : No such file or directory
> + die 'gerrit/commit-msg failed'
>
> I have tried to add set -x in gerrit/commit-msg, nothing shows up...

The gerrit/commit-msg script is a copy of one provided by Gerrit, but
it is not our code.  We run it from our main commit-msg script with
this code:

gerrit_hook() {
	"$GIT_DIR/hooks/gerrit/commit-msg" "$@" ||
	die 'gerrit/commit-msg failed'
}

Since adding "set -x" to gerrit/commit-msg does nothing let's first
make sure the script is actually running.  Try adding a bunch of

  echo "gerrit/commit-msg: $LINENO" 2>&1

lines spread through the script.  That should confirm that it is
running and narrow down the failure.

On 01/11/2011 05:34 PM, Arnaud GELAS wrote:
> Also note that .git/COMMIT_MSG does not exist, but is called
> .git/COMMIT_EDITMSG (and this may be updated in the die function of the
> hooks).

That is a bug in our commit-msg script.  It should not mention that
file after deleting it.  I fixed that part:

  http://itk.org/gitweb?p=ITK.git;a=commitdiff;h=b22ff892

Update your local hooks by running the developer setup script again
or by:

  git fetch origin
  cd .git/hooks
  git pull .. remotes/origin/hooks

That will get at least the COMMIT_MSG fix.

-Brad


More information about the Insight-developers mailing list