views:

1051

answers:

4

As I am running out of my space on GitHub on my free account (yes, I am considering upgrading), I am setting up new git repositories on Gitorious (see also GitHub vs Gitorious). One great feature of GitHub is the post-commit hooks, that allow me to notify the (also great) CIA network...

However, I have been unable to find if Gitorious supports such hooks... So, I'd like to ask best practices for getting commit messages show up on the CIA network for Gitorious-hosted git repositories.

Update: the solution of using a secondary mechanism to trigger CIA commit messages is not what I am looking for.

+1  A: 

My current workaround is to set up a loal repository (called CIA) and always push via a tiny shell script:

#!/bin/bash
set -e
git push origin master
git push cia master

In the local CIA repository I installed http://cia.vc/clients/git/ciabot.bash to send emails to the CIA.

maxy
I guess the first push should be a pull?
Egon Willighagen
no, I always push the same commits to two different repository, the gitorious one (origin) which is where I want my code, and my local one (CIA) that will send the emails when I push
maxy
+2  A: 

The KDE project had a similar question in that thread, with an interesting alternative:

It doesn't have to be running on gitorious.org machines. At least, not for email/CIA/RSS/whatever reporting

That's how our old git-p4 hook worked in the office:
the p4 machine sent out a UDP packet with the revision number. Another machine caught it and did the import. (the value was discarded)

We could do the same:

  • the gitorious.org machine sends a UDP packet with the branches that changed and their new SHA-1.
  • Another machine fetches and produces the commit logs.
    Worst case scenario is that someone is forgotten due to a dropped UDP packet.

Like I said, this works for reporting -- for anything that is run by a post-receive hook.
For anything requiring a pre-receive hook (actually, pre-update, but the name is wrong in Git), it will have to be run on their servers.

VonC
Who is 'you' in your comment?
Egon Willighagen
@Egon: sorry, that was a first incorrect edit in my initial answer. I meant the KDE project.
VonC
+2  A: 

Instead of pushing straight to Gitorious, push to a local repository that you've configured (in its post-receive hook) to both push everything to your Gitorious repository and notify CIA.

Andrew Aylett
How would I configure that local repository?
Egon Willighagen
Put your CIA notification in the update hook (@maxy put a link: http://cia.vc/clients/git/ciabot.bash). In the post-update hook, put a "git push --mirror Gitorious/url" (or git push --all, whichever is more appropriate)
Andrew Aylett
+2  A: 

Gitorious is getting web hook support. It is currently running on gitorious.org, but without a UI for adding them to your repository; the reason for this is that there still may be a change or two to the JSON representation of the commit data exposed, so it should be configured a beta feature.

Anyone feeling up to writing integration code (handling gitorious' web hook requests), please send an email to support at gitorious.org and we'll set up the integration for your repository

zmalltalker
Could you please add some URLs to further info on this hook support?
Egon Willighagen
An example (and history) of the JSON payload generated is at http://www.postbin.org/wqpx3l
zmalltalker