I'm writing a pre-receive hook to do some validation before accepting commits on the push. It works fine with existing branches since I use following git command to get a list of incoming commits:
git rev-list $old_sha1..$new_sha1
However, above command fails if user pushing a new branch into a shared repository because
old_sha1 is all zeros. So the question is how do I get a list of incoming commits for a
newly created branch. Doing git rev-list $new_sha1
does not work since it gives all revisions till the beginning of times. Is there a way to specify something like this:
git rev-list $branching_sha1..$new_sha1