Re: [PATCH v3 6/6] update-ref: add support for 'symref-update' command
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jun 5, 2024, 08:02 UTC
- Message-ID
- <ZmAbi6RtD7EFkKJm@tanuki>
- In-Reply-To
- <20240530120940.456817-7-knayak@gitlab.com>
On Thu, May 30, 2024 at 03:09:40PM +0300, Karthik Nayak wrote:
Show 19 quoted lines
> From: Karthik Nayak <karthik.188@gmail.com> > > 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