Re: [PATCH v3 6/6] update-ref: add support for 'symref-update' command
From: Patrick Steinhardt <hidden>
Date: 2024-06-05 08:02:23
Attachments
- signature.asc [application/pgp-signature] 833 bytes
From: Patrick Steinhardt <hidden>
Date: 2024-06-05 08:02:23
On Thu, May 30, 2024 at 03:09:40PM +0300, Karthik Nayak wrote:
From: Karthik Nayak <redacted> Add 'symref-update' command to the '--stdin' mode of 'git-update-ref' to allow updates of symbolic refs. The 'symref-update' command takes in a <new-target>, which the <ref> will be updated to. If the <ref> doesn't exist it will be created. It also optionally takes either an `ref <old-target>` or `oid <old-oid>`. If the <old-target> is provided, it checks to see if the <ref> targets the <old-target> before the update. If <old-oid> is provided it checks <ref> to ensure that it is a regular ref and <old-oid> is the OID before the update. This by extension also means that this when a zero <old-oid> is provided, it ensures that the ref didn't exist before. The divergence in syntax from the regular `update` command is because if we don't use a `(ref | oid)` prefix for the old_value, then there is ambiguity around if the value provided should be treated as an oid or a reference. This is more so the reason, because we allow anything committish to be provided as an oid.
It would be nice to explain why this isn't needed for symref-delete and symref-create, which also both have an old value. Patrick