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

Arnaud GELAS arnaud_gelas at hms.harvard.edu
Tue Jan 11 18:36:02 EST 2011


Brad,

Thanks for fixing the error message!

I have added bunch of echo [...] $LINENO in gerrit/commit-msg, but 
nothing showed up.

Here is the output (with set -x)

+ case "$hooks_GerritId" in
+ gerrit_hook .git/COMMIT_EDITMSG
+ .git/hooks/gerrit/commit-msg .git/COMMIT_EDITMSG
: No such file or directory
+ die 'gerrit/commit-msg failed'
+ echo 'commit-msg hook failure'
commit-msg hook failure

It seems gerrit/commit-msg is not running...

It may be a path issue?

I have just tried to change "$GIT_DIR/hooks/gerrit/commit-msg"  by  
"./gerrit/commit-msg"
gerrit/commit-msg is now running but quickly fails...

.git/hooks/commit-msg: line 135: ./gerrit/commit-msg: No such file or 
directory
+ die 'gerrit/commit-msg failed'
+ echo 'commit-msg hook failure'

I'll try to change all path in gerrit/commit-msg

Arnaud


On 01/11/2011 06:16 PM, Brad King wrote:
> 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