tags:

views:

91

answers:

2

I'd like to know how to check if something is committed to a repository through git. The idea is to take the committed files into a code review tool.

+7  A: 

You want a hook that pushes the new code into the code review tool: http://www.kernel.org/pub/software/scm/git/docs/githooks.html

Aaron Maenpaa
A: 

Perhaps the simplest would be to run git-count-objects and see when the number of objects increases. Poll every 5 minutes or as you see fit.

$ git count-objects -v
count: 13
size: 568
in-pack: 48
packs: 1
prune-packable: 0
garbage: 0

"count" is unpacked, "in-pack" is packed, so "count"+"in-pack" should increase with a commit by at least one.

Or use a hook.

Colin Burnett
git count-objects only counts unpacked objects, so isn't reliable for something like this: if push sends enough objects, the server will just keep the pack.
araqnid
And the -v flag will take care of that issue.
Colin Burnett
You could also poll `git rev-parse HEAD` and see if it changes
dbr