Capture reference changes into a transaction in reference transaction hook
Transactions perform their Git operations against their snapshots as described in Initial blueprint for transaction management in... (gitlab!122028 - merged). In order to commit the changes performed in the snapshot, we need to capture them. This MR wires transactions to the reference-transaction
hook in order to do so. This is achieved by:
- Supporting multiple updates to a given reference during a transaction. This is necessary as some existing code may update a reference multiple times.
- Recording the initial reference value before the first update. This enables us to automatically figure out the reference's value at the beginning of the transaction as not all code paths provide that.
- Piping the transaction through to the
reference-transaction
hook and using the above two methods to record the changes.
With the changes recorded in the transaction, they can be eventually be committed with it.