How do I get a git diff
in a pre-receive hook between A and B?
somefile.ext
as viewed in) current HEAD on serversomefile.ext
as viewed in) received tree from pre-receive hookI need this, because when some files change (on a Gitolite server), we like to be notified and see the difference between A and B by e-mail.
Environment: Ubuntu server 11 + Gitolite + pre-receive hook
I think you actually want to use post-receive, as pre-receive is mostly used to reject updates and post-receive for notifications (which seems what you want to do).
Both get the same input (through stdin) and it's documented in githooks(5)
The input is a list of updated refs and their old and new commit hashes.
You could use this data to do your git diff