multiple post-receive hooks will pass through

51 views
Skip to first unread message

Andrei Neculau

unread,
Jan 25, 2017, 10:06:01 AM1/25/17
to gitolite
Using gitolite 3.6.5

I have multiple post-receive hooks set up as

option hook.pre-receive.foo = foo
option hook.pre-receive.bar = bar

if foo fails (exits with status 1), gitolite will continue running bar


this seems to stem from the way multi-hook-driver is written. by checking the exit code after every script runs, I can make gitolite fail after foo fails

for h in $0.*; do
[ -x $h ] || continue
if [ $type = args ]
then
$h $@
rc=$?
[ $0 = hooks/pre-receive ] && [ $rc != 0 ] && exit $rc || true
else
echo "$stdin" | $h
rc=$?
[ $0 = hooks/pre-receive ] && [ $rc != 0 ] && exit $rc || true
fi
done


* altenatively to "|| true", one could also append "exit 0" at the end of the multi-hook-driver

Sitaram Chamarty

unread,
Jan 25, 2017, 11:51:15 AM1/25/17
to Andrei Neculau, gitolite
On Wed, Jan 25, 2017 at 07:06:00AM -0800, Andrei Neculau wrote:
> Using gitolite 3.6.5
>
> I have multiple post-receive hooks set up as
>
> option hook.pre-receive.foo = foo
> option hook.pre-receive.bar = bar
>
> if foo fails (exits with status 1), gitolite will continue running bar

Sorry, but that won't be changing. 'man githooks' does not
assign any meaning to the exit status of that hook, and I intend
to stay consistent with that.

regards
sitaram

PS: pre-receive and pre-auto-gc are different, of course; a
non-zero exit has meaning there. At the moment, the
documentation on repo-specific hooks says "use only one hook
[for these]". There's also an entry in my todo list to fix that
(i.e., allow more than one, and do the right "abort on first
fail" thing), as the result of this topic coming up some days
ago.

Stephen Morton

unread,
Jan 25, 2017, 1:21:18 PM1/25/17
to Sitaram Chamarty, Andrei Neculau, gitolite
Andrei,

I am confused because you mention *post*-receive in the email subject and text, but *pre*-receive in the conf file excerpts. Which is it that you mean? This is important as the exit statuses are treated differently.

Regards,
Stephen


--
You received this message because you are subscribed to the Google Groups "gitolite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitolite+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrei Neculau

unread,
Jan 25, 2017, 1:25:48 PM1/25/17
to Stephen Morton, Sitaram Chamarty, gitolite
Stephen, I meant pre-receive. Thanks

Sitaram Chamarty

unread,
Jan 25, 2017, 1:50:43 PM1/25/17
to Andrei Neculau, Stephen Morton, gitolite
On Wed, Jan 25, 2017 at 07:25:45PM +0100, Andrei Neculau wrote:
> Stephen, I meant pre-receive. Thanks

Thanks Stephen for catching that; I certainly did not. I
changed the subject line in this mail accordingly (helps people
searching the ML archives).

As far as pre-receive is concerned, what I said in the PS of my
previous email applies; it's on the todo list to make it stop on
the first failure.

regards
sitaram

tlee

unread,
May 12, 2020, 5:33:36 PM5/12/20
to gitolite
Hi,
We currently have one pre-receive hook repo specific enabled and is working fine.
Now, we want to add all repos pre-receive hook and I notice that the repos that have repo specifics hook, only one will work correctly and others do not execute or show warning but still update. 
So how can we have one for all repos and one repo specific pre-receive hook implemented in Gitolite correctly?

Running gitolite3 v3.6.6-3-g72c0238
We have the hooks applied to Gitolite admin repo
LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local"
pre-receive hooks are located in = /local/hooks/repo-specific

Let me know.
Thanks,
Tom
> >> To unsubscribe from this group and stop receiving emails from it, send an email to gito...@googlegroups.com.

Sitaram Chamarty

unread,
May 22, 2020, 12:29:16 PM5/22/20
to tlee, gitolite
Very sorry for the delay; WFH apparently means "more" W than H :-)

Could you send your conf file, at least the relevant bits?

sitaram

On 5/13/20 3:03 AM, tlee wrote:
> Hi,
> We currently have one pre-receive hook repo specific enabled and is
> working fine.
> Now, we want to add all repos pre-receive hook and I notice that the
> repos that have repo specifics hook, only one will work correctly and
> others do not execute or show warning but still update.
> So how can we have one for all repos and one repo specific pre-receive
> hook implemented in Gitolite correctly?
>
> Running gitolite3 v3.6.6-3-g72c0238
> We have the hooks applied to Gitolite admin repo
> LOCAL_CODE=>"$rc{GL_ADMIN_BASE}/local"
> pre-receive hooks are located in = /local/hooks/repo-specific
>
> Let me know.
> Thanks,
> Tom
>
> On Wednesday, January 25, 2017 at 10:50:43 AM UTC-8, Sitaram Chamarty wrote:
>
> On Wed, Jan 25, 2017 at 07:25:45PM +0100, Andrei Neculau wrote:
> > Stephen, I meant pre-receive. Thanks
>
> Thanks Stephen for catching that; I certainly did not.  I
> changed the subject line in this mail accordingly (helps people
> searching the ML archives).
>
> As far as pre-receive is concerned, what I said in the PS of my
> previous email applies; it's on the todo list to make it stop on
> the first failure.
>
> regards
> sitaram
>
> >
> > --
> > http://andreineculau.com
> >
> > > On 25 Jan 2017, at 19:21, Stephen Morton <stephen...@gmail.com
> it, send an email to gito...@googlegroups.com <javascript:>.
> > >> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "gitolite" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to gitolite+u...@googlegroups.com
> <mailto:gitolite+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gitolite/9d615a3b-46c4-44bd-ad8b-35adc5e41075%40googlegroups.com
> <https://groups.google.com/d/msgid/gitolite/9d615a3b-46c4-44bd-ad8b-35adc5e41075%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
sitaram
Reply all
Reply to author
Forward
0 new messages