[go: up one dir, main page]

Skip to content

Provide `ExpectedOldOID` to UserCommitFiles request

Context

Epic: Provide `ExpectedOldOID` to avoid race conditio... (&9345)

RPC UserCommitFiles 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.

With the changes in published in https://rubygems.org/gems/gitaly/versions/15.6.0.pre.rc3, we now allow RPCs to provide expected_old_oid which is used to verify the ref update, failing if the ref doesn't point to that object ID during the update.

RPC Invalid SHA format Valid SHA, but not present in repo Present in repo but not the latest SHA for the reference
UserCommitFiles InvalidArgument InvalidArgument FailedPrecondition

Required changes

  1. Extend UserCommitFiles request to support expected_old_oid field
  2. Populate expected_old_oid field for all usages of this RPC and handle new errors
Edited by Karthik Nayak