Skip to content

fetch: Add expected_old_oid to prevent races

James Liu requested to merge jliu-fetch-source-branch-old-oid into master

#4780 (closed)

The expected_old_oid field has been introduced in many RPCs to help prevent race conditions. This value indicates what the caller expects a particular reference to point to before it's updated, and is validated by Git before the update occurs. If the value changes in the meantime, an error is returned.

Add expected_old_oid to the FetchSourceBranch RPC. In this case, it indicates the OID that the target reference should point to, before a source branch is fetched into it. Return a structured gRPC error if the error occurs.

Edited by James Liu

Merge request reports