From: Karthik Nayak <karthik.188@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, gitster@pobox.com, Jeff King <peff@peff.net>
Subject: Re: [PATCH 6/6] update-ref: add support for 'symref-update' command
Date: Wed, 22 May 2024 07:59:30 +0000 [thread overview]
Message-ID: <CAOLa=ZRNNBOzsw+EzEJVnAU0ZsJ-bcTpciExdsQz2iDatYkqNQ@mail.gmail.com> (raw)
In-Reply-To: <CAOLa=ZQW-cCV5BP_fCvuZimfkjwAzjEiqXYRPft1Wf9kAX=_bw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1977 bytes --]
Karthik Nayak <karthik.188@gmail.com> writes:
> Patrick Steinhardt <ps@pks.im> writes:
>
>> On Tue, May 14, 2024 at 02:44:11PM +0200, Karthik Nayak wrote:
>>> 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.
>>
>> It's somewhat unfortunate that the syntax diverges from the "update"
>> command. "update" also has essentially the same issue now, that we
>> cannot verify that its old value is a symref, right? Can we fix that in
>> a backwards compatible way?
>>
>
> I think Peff mentioned [1] of a way. So we convert the existing
>
> update SP <ref> SP <newvalue> [SP <oldvalue>] LF
> update SP <ref> NUL <newvalue> NUL [<oldvalue>] NUL // -z
>
> to
>
> update SP <ref> SP <newvalue> [SP (<oldvalue> | ref <old_target>)] LF
> update SP <ref> NUL <newvalue> NUL [(<oldvalue> | ref NUL <old_target>)] NUL // -z
>
> this should work, I think. I will play around this and add it in. Please
> let me know if you can think of a scenario where this breaks.
Thinking about this more, I'll actually do this in a follow up series. I
want to cleanup the existing tests already to move them to the loop that
I introduced in this series. That would make it easier to test and
ensure that we can port the existing 'update' command to also support
`old_target`.
[snip]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]
next prev parent reply other threads:[~2024-05-22 7:59 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 12:44 [PATCH 0/6] update-ref: add symref support for --stdin Karthik Nayak
2024-05-14 12:44 ` [PATCH 1/6] refs: create and use `ref_update_ref_must_exist()` Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-17 13:08 ` Karthik Nayak
2024-05-14 12:44 ` [PATCH 2/6] update-ref: add support for 'symref-verify' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-17 16:21 ` Karthik Nayak
2024-05-21 6:41 ` Patrick Steinhardt
2024-05-14 12:44 ` [PATCH 3/6] update-ref: add support for 'symref-delete' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-14 12:44 ` [PATCH 4/6] update-ref: add support for 'symref-create' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-19 14:01 ` Karthik Nayak
2024-05-14 12:44 ` [PATCH 5/6] reftable: pick either 'oid' or 'target' for new updates Karthik Nayak
2024-05-14 12:44 ` [PATCH 6/6] update-ref: add support for 'symref-update' command Karthik Nayak
2024-05-16 11:09 ` Patrick Steinhardt
2024-05-21 9:49 ` Karthik Nayak
2024-05-22 7:59 ` Karthik Nayak [this message]
2024-05-22 9:03 ` [PATCH v2 0/6] update-ref: add symref support for --stdin Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 1/6] refs: create and use `ref_update_expects_existing_old_ref()` Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 2/6] update-ref: add support for 'symref-verify' command Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 3/6] update-ref: add support for 'symref-delete' command Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 4/6] update-ref: add support for 'symref-create' command Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 5/6] reftable: pick either 'oid' or 'target' for new updates Karthik Nayak
2024-05-22 9:03 ` [PATCH v2 6/6] update-ref: add support for 'symref-update' command Karthik Nayak
2024-05-25 23:00 ` Junio C Hamano
2024-05-29 8:29 ` Karthik Nayak
2024-05-23 15:02 ` [PATCH v2 0/6] update-ref: add symref support for --stdin Junio C Hamano
2024-05-23 15:52 ` Karthik Nayak
2024-05-23 16:29 ` Junio C Hamano
2024-05-23 17:50 ` Karthik Nayak
2024-05-23 17:59 ` Eric Sunshine
2024-05-23 18:08 ` Junio C Hamano
2024-05-23 18:50 ` Eric Sunshine
2024-05-23 19:06 ` Junio C Hamano
2024-05-23 21:46 ` Junio C Hamano
2024-05-23 16:03 ` Junio C Hamano
2024-05-30 12:09 ` [PATCH v3 " Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
2024-05-30 12:09 ` [PATCH v3 1/6] refs: create and use `ref_update_expects_existing_old_ref()` Karthik Nayak
2024-05-30 12:09 ` [PATCH v3 2/6] update-ref: add support for 'symref-verify' command Karthik Nayak
2024-05-30 12:09 ` [PATCH v3 3/6] update-ref: add support for 'symref-delete' command Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
2024-06-05 9:31 ` Karthik Nayak
2024-06-05 16:22 ` Junio C Hamano
2024-05-30 12:09 ` [PATCH v3 4/6] update-ref: add support for 'symref-create' command Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
2024-05-30 12:09 ` [PATCH v3 5/6] reftable: pick either 'oid' or 'target' for new updates Karthik Nayak
2024-05-30 12:09 ` [PATCH v3 6/6] update-ref: add support for 'symref-update' command Karthik Nayak
2024-06-05 8:02 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOLa=ZRNNBOzsw+EzEJVnAU0ZsJ-bcTpciExdsQz2iDatYkqNQ@mail.gmail.com' \
--to=karthik.188@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).