Thread (16 messages) 16 messages, 4 authors, 2024-09-30

Re: [PATCH v3 1/2] update_symref: add REF_CREATE_ONLY option

From: Bence Ferdinandy <hidden>
Date: 2024-09-29 23:04:12

Possibly related (same subject, not in this thread)

On Sun Sep 22, 2024 at 00:19, Bence Ferdinandy [off-list ref] wrote:
On Sat Sep 21, 2024 at 15:40, Phillip Wood [off-list ref] wrote:
quoted
On 19/09/2024 13:13, Bence Ferdinandy wrote:
quoted
Add a new REF_CREATE_ONLY flag for use by the files backend which will
only update the symref if it doesn't already exist. Add the possibility
to pass extra flags to refs_update_symref so that it can utilize this
new flag.
I'm not sure we need a new flag to do this as it is already supported by
the ref transaction api.
Thanks, I was not aware of ref_transaction_create. It also seems to return with
TRANSACTION_NAME_CONFLICT so we should be able to see from the error code if
indeed the existence was the problem or something else went wrong.
Unfortunately, it seems that my reading of the code did not pass practice. When
using ref_transaction_create ref_transaction_commit will return with -2 if the
reference already exists, but it also returns with -2 for various other issues,
like if the lock file already exists. I could parse the error message to see
what was the cause, but that doesn't feel like a robust solution. Since fetch
should _not_ error out on this, I think the REF_CREATE_ONLY flag is warranted.
As it stands, it would serve a different purpose than ref_transaction_create,
i.e. a "silent" create-only. 

I'll send a v4 tomorrow hopefully.

Best,
Bence
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help