Setting up post commit emails in gitolite ?

1,830 views
Skip to first unread message

Gaurav Chakravorty

unread,
Jun 27, 2011, 4:30:35 PM6/27/11
to gito...@googlegroups.com
Any pointers on how to go about setting up gitolite to send email for
each commit to the specified list for a repository ?

Best,
Gaurav Chakravorty
Circulum Vite LLC       www.circulumvite.com
2500 PLAZA 5 . Harborside Financial Center, Jersey City, NJ 07311-4026
Tel: 201-377-2302      Fax: 201-604-5422     Cell: 201-500-7416
Linkedin: linkedin.com/in/gauravchak

Brett Neumeier

unread,
Jun 27, 2011, 5:23:14 PM6/27/11
to Gaurav Chakravorty, gito...@googlegroups.com
On Mon, Jun 27, 2011 at 3:30 PM, Gaurav Chakravorty
<gc...@circulumvite.com> wrote:
> Any pointers on how to go about setting up gitolite to send email for
> each commit to the specified list for a repository ?

(oops, forgot to cc the list on my reply)

That sounds like a job for a post-receive hook script. For example,
the post-receive-email script included in the git distribution in
contrib/hooks:

# An example hook script to mail out commit update information. This hook
# sends emails listing new revisions to the repository introduced by the
# change being reported. The rule is that (for branch updates) each commit
# will appear on one email and one email only.

And you can look at the excellent gitolite documentation for
information on how to use hooks with gitolite. For example:

https://github.com/sitaramc/gitolite/blob/pu/doc/2-admin.mkd
https://github.com/sitaramc/gitolite/blob/pu/doc/gitolite.conf.mkd
https://github.com/sitaramc/gitolite/blob/pu/doc/hook-propagation.mkd

--
Brett Neumeier (bneu...@gmail.com)

Alexander Gladysh

unread,
Jun 28, 2011, 1:46:02 AM6/28/11
to Gaurav Chakravorty, gito...@googlegroups.com
On Tue, Jun 28, 2011 at 00:30, Gaurav Chakravorty
<gc...@circulumvite.com> wrote:
> Any pointers on how to go about setting up gitolite to send email for
> each commit to the specified list for a repository ?

Please see this SO question:
http://stackoverflow.com/questions/5055190/how-to-setup-post-receive-email-git-hook-with-gitolite

HTH,
Alexander.

Björn Rüffer

unread,
Jun 28, 2011, 1:52:02 AM6/28/11
to gito...@googlegroups.com
>> Any pointers on how to go about setting up gitolite to send email for
>> each commit to the specified list for a repository ?

I use post-receive to send emails for each _push_ as described in the
gitolite documentation. Per commit email notification is possible if
you use a post-commit hook. And btw, there's a nice colorful
replacement for the standard git supplied post-receive-email hook to
be found at https://github.com/bitboxer/git-commit-notifier

Quoting from its documentation:

> If you want to send mails on each commit instead on each push, you should add a file called “post-commit” with this content:

> #!/bin/sh
> echo "HEAD^1 HEAD refs/heads/master" | git-commit-notifier path_to_config.yml

So basically, you could replicated that up to the pipe signal and just
use the standard git supplied email script instead of
git-commit-notifier.

B.

Eli Barzilay

unread,
Jun 28, 2011, 2:19:12 AM6/28/11
to Björn Rüffer, gito...@googlegroups.com
20 minutes ago, Björn Rüffer wrote:
> I use post-receive to send emails for each _push_ as described in
> the gitolite documentation. Per commit email notification is
> possible if you use a post-commit hook.

That's likely to be the wrong thing, especially when gitolite is
involved (which means that there's a central repository). If you want
per-commit emails, it's much better to have a single post-receive hook
that iterates over the new commits (which is easy) and sends an email
for each.


> So basically, you could replicated that up to the pipe signal and
> just use the standard git supplied email script instead of
> git-commit-notifier.

For some people who might miss it: if you really want to have colors
and such, another nice option is to just have links to a gitweb
interface and/or to a github mirror. (And if you don't have one,
setting it up might be a similar amount of work, and you get more...)

--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!

Reply all
Reply to author
Forward
0 new messages