Experimental: repository transactions
This experiment tries to use a ref to "lock" the repository for a transaction in the following way:
-
start transaction -
git update-ref refs/tx/transaction <blob_id> 0000000000000000000000000000000000000000
When something wants to mutate a repository, it first has to be able to write a new ref at 'refs/tx/transaction'. Sinceupdate-ref
is atomic, only one process will be able to do this. The rev can be of an id of a blob that we write that contains some metadata about the transaction. (currently only including the actual command that is to be run) -
commit transaction -
git update-ref -d refs/tx/transaction
When we want to commit a transaction, we simply delete therefs/tx/transaction
ref after whatever mutation we want to do to the repository.
Edited by John Cai