Download raw body.
gotd: initial implementation of the delete-refs capability
On Fri, Jan 27, 2023 at 05:37:26PM +0100, Omar Polo wrote:
> This makes "got send -d" works against gotd.
>
> The idea is that, if a server supports this capability, clients can
> delete references by sending a zero-id value as the target value of
> the update.
The client actually sends an old-id and a new zero-id.
> I'm not 100% sure the locking is right, but it resambles the update
> case so maybe it is.
After locking, gotd should resolve the ref to obtain its current ID,
and not delete if current ID != old ID sent by the client.
Otherwise, during a race, one client would silently win over another.
> There are some improvements that we can do on top of this:
>
> - the ref_is_new and delete_ref fields of the struct
> gotd{,_imsg}_ref_update could be merged in a single field using an
> enum, and
Not worth it, I would say. Just keep two flags.
> - as a special case (but it's actually the more common one I guess),
> the session process could avoid sending the fds for the pack idx
> and data when a client is only deleting references.
Not sure. Just keep sending them for now, so we have less special cases.
gotd: initial implementation of the delete-refs capability