tags:

views:

31

answers:

0

I'm using Gitosis to manage a set of repositories. The problem I have is that Gitosis doesn't maintain a record of which user pushed a particular commit. The only information I have are the "Author" and "Committer" fields in the commit itself, and these could be set to anything at all by the "pusher".

Now I realise that a single "push" can send many, many commits to the Gitosis server, and each of them would have been created by the individual developer, so I should restrict myself by saying I'm only interested in the head commit on the branch that's been pushed. This commit will (should!) have been created by the person creating the release, so I want to know who that is so I can go beat them up if there are problems.

The idea I have is to use a hook on the server to compare the head commit's Committer to the gitosis user name. If they're both "[email protected]" then the pusher is the committer and the push is allowed, otherwise it is rejected. Is that feasible? Which hook should I use - I think "update" is the one, though pre-receive and post-receive are possibles too.

I also thought about using the post-receive hook to tag the head commit, getting it to put the pusher's user name in the annotated tag message. The problem with this is that someone looking at the commit won't necessarily be aware of the tag.

I'm open to other suggestions on how to do this. The basic idea is that I want to know which Gitosis user pushed to a particular branch.

If I could find out who pushed a tag (or restrict the pusher to be the tagger) then that would be even better!

Kevin