Introduce reference transactions

It's been a long time coming, and I think this is my third attempt at this, but I finally found something I'm happy with.

This allows us to lock and modify references en-masse, making it useful for dependent updates or replication. 

The API isn't purely about transactions but also exposes the locking, which you can use by itself to lock a reference and do operations which need it to be locked, as stash needs to do in order to drop entries from the reflog.

I've also tried something a bit different with memory allocation here (at least as far as my code goes). Some code in the library already uses pools, but here I'm going a bit further and giving the transaction object its own memory pool such that every allocation is either freed immediately or made/copied into the pool. This lets us simply return an error code when we find an error and the `GITERR_CHECK_ALLOC()` calls don't cause us to leak memory. The transaction structure feels like a very good match for this type of memory management, since what we do is build up work to do and then throw all the memory away when we're done.

I realise there's no documentation, I'll get to it in a bit if people don't hate this. I'm thinking of also simply getting rid of `git_reflog_write()` since going through the transaction to perform locking is the only safe way to do this anyway.