git server-side hooks dont work with gerrit?

1,102 views
Skip to first unread message

Bertram Karch

unread,
Feb 21, 2014, 1:39:36 PM2/21/14
to repo-d...@googlegroups.com
Hi,

I tried to use the git server-side hook pre-receive but it seems that gerrit does not calls any git hooks?

I placed the script on the gerrit server in the directory myrepo.git/hooks, chmod +x, but no effect.

I want that gerrit calls my script and if the scripts returns -1 the push to gerrit should be rejected.
First I tried the gerrit hook patchset-created, but gerrit ignores the result of hook scripts :-(

Can I use any git hooks on the gerrit server?



Matthias Sohn

unread,
Feb 21, 2014, 4:25:03 PM2/21/14
to Bertram Karch, Repo and Gerrit Discussion

Bertram Karch

unread,
Feb 22, 2014, 11:56:23 AM2/22/14
to repo-d...@googlegroups.com, Bertram Karch
Hi Matthias,

thank your for the reminder to the hooks docu and the confirmation that git hooks dont work.
I have read the docu many times but now I have recognized that ref-update is exactly what I am looking for.
Its the only hook which can reject the push so I can use that for server side checks.

Thanks

Bertram

Edwin Kempin

unread,
Feb 24, 2014, 5:03:55 AM2/24/14
to Bertram Karch, Repo and Gerrit Discussion
2014-02-22 17:56 GMT+01:00 Bertram Karch <bek...@googlemail.com>:
Hi Matthias,

thank your for the reminder to the hooks docu and the confirmation that git hooks dont work.
I have read the docu many times but now I have recognized that ref-update is exactly what I am looking for.
Its the only hook which can reject the push so I can use that for server side checks.
You could also write a Gerrit plugin which implements a CommitValidationListener [1].
By throwing a CommitValidationException you can reject a push from there.
 

Thanks

Bertram

Am Freitag, 21. Februar 2014 22:25:03 UTC+1 schrieb Matthias Sohn:
On Fri, Feb 21, 2014 at 7:39 PM, Bertram Karch <bek...@googlemail.com> wrote:
Hi,

I tried to use the git server-side hook pre-receive but it seems that gerrit does not calls any git hooks?

I placed the script on the gerrit server in the directory myrepo.git/hooks, chmod +x, but no effect.

I want that gerrit calls my script and if the scripts returns -1 the push to gerrit should be rejected.
First I tried the gerrit hook patchset-created, but gerrit ignores the result of hook scripts :-(

Can I use any git hooks on the gerrit server?

no, Gerrit has its own hooks [1], for a discussion about the reasons see [2]


--
Matthias

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages