I am writing a pre-receive hook for Git. This is the one where if multiple commits are pushed, and any one of them fail, then the whole push fails. Which is what I want.
My problem is that not all the hashes from all commits are passed in. Only the most recent commit hash is, e.g.
2 commits are being pushed to a repo:
Commit 1 - 4b5w<br> Commit 2 - 6gh7 -------------> passed in to pre-receive hook, but I want the previous hash too.
I can’t use the update hook which is called for each ref, because I don’t want any commits to go through if any one of them fails, e.g. commit 1 passing and commit 2 failing is not acceptable, as I would have to somehow rollback commit 1 when commit 2 fails.
How do I get the hashes from ALL commits being passed to the pre-receive hook?