Introduce reference transactions

A transaction allows you to lock multiple references and set up changes
for them before applying the changes all at once (or as close as the
backend supports).

This can be used for replication purposes, or for making sure some
operations run when the reference is locked and thus cannot be changed.
stash: use a transaction to modify the reflog

The stash is implemented as the refs/stash reference and its reflog. In
order to modify the reflog, we need avoid races by making sure we're the
only ones allowed to modify the reflog.

We achieve this via the transactions API. Locking the reference gives us
exclusive write access, letting us modify and write it without races.
transaction: add documentation
Add changelog for transactions