RPCs lacks ability to let clients update a reference without races
RPCs like UserMergeBranch (full list below) does not allow passing an old object ID that the target branch that is about to be updated is expected to point to. Because of that shortcoming it is possible for there to be a race when the branch has been updated meanwhile by a different client.
Gitaly should grow a new field expected_old_oid
or similar in these RPCs so that the client can tell us to only update the reference in case it indeed points to that old commit. This is something that git-update-ref(1) gives us for free, we just ought to use the capabilities.
List of RPCs to be updated:
- UserApplyPatch
- UserDeleteBranch
- UserCherryPick
- UserCommitFiles
- UserMergeBranch
- UserFFBranch
- UserRevert
- UserUpdateSubmodule
- UserDeleteTag
Edited by Karthik Nayak