Re: [PATCH v2 5/7] update-ref: add support for symref-create
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 19, 2024, 15:48 UTC
- Message-ID
- <xmqqil0dmjyv.fsf@gitster.g>
- In-Reply-To
- <ZiI8GaGupNzbLqnE@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 8 quoted lines
>> + if (!new_ref)
>> + die("symref-create %s: missing <new-ref>", refname);
>> + if (read_ref(new_ref, NULL))
>> + die("symref-create %s: invalid <new-ref>", refname);
>
> This restricts the creation of dangling symrefs, right? I think we might
> want to lift this restriction, in which case we can eventually get rid
> of the `create_symref` callback in ref backends completely.True.
Show 8 quoted lines
>> @@ -2609,6 +2609,27 @@ static int lock_ref_for_update(struct files_ref_store *refs,
>> }
>> }
>>
>> + if (update->flags & REF_SYMREF_UPDATE && update->new_ref) {
>
> Let's add braces around `(updaet->flags & REF_SYMREF_UPDATE)` to make
> this easier to read.Yup, the language may not require the extra pair of parentheses, but human eyes are helped by them.
Thanks, again and as always, for carefully reading.