I'm creating an update hook so that our central git repository can do some simple sanity checks of each file in each commit. However, I don't know how to make git cough up the names of all of the commits in a "push".
No matter how many commits the client is pushing, the update hook is called just once (by design). For example, suppose that HEAD is e2706ec, and I create two commits:
$ echo 'date' >>foo && git commit -am'Touched foo'
[master e5c9682] Touched foo
1 files changed, 1 insertions(+), 0 deletions(-)
$ echo 'date' >>bar && git commit -am'Touched bar'
[master bdc1fd1] Touched bar
1 files changed, 1 insertions(+), 0 deletions(-)
Then I push the code to the central repository:
$ git push
The .git/hooks/update script gets called once with these arguments:
- refs/heads/master
- e2706ec31e51b9bbd4010e79fd7186089c59690e
- bdc1fd17e8209bbb987b5358a0b49b20d9589103
Git passes to the update hook the ref_name, old_rev, and new_rev. What it doesn't pass are the names of any revs between old_rev and new_rev (in this case, e5c9682).
Given old_rev and new_rev, what is the git spell to get each rev that the client is attempting to push?