GNU bug report logs -
#65352
Fix time-machine and network
Previous Next
Full log
Message #35 received at 65352 <at> debbugs.gnu.org (full text, mbox):
Hi Simon,
Simon Tournier <zimon.toutoune <at> gmail.com> writes:
> Hi Maxim,
>
> On Thu, 17 Aug 2023 at 17:42, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> wrote:
>
>> > (match ref
>> > - ((or ('commit . commit)
>> > - ('tag-or-commit . commit))
>> > + (('tag-or-commit . commit)
>
>> Not that channel-list is a public API, so this is effectively changing
>> the contract, no?
>
> Well, the contract is not clearly defined. ;-)
>
> The REF is defined by the docstring of update-cached-checkout,
>
> REF is pair whose key is [branch | commit | tag | tag-or-commit ] and value
> the associated data: [<branch name> | <sha1> | <tag name> | <string>].
> If REF is the empty list, the remote HEAD is used.
Good catch, it seems tag is not covered.
> Therefore, if we want to be compliant with the public API, we also
> need to add 'tag' to the 'or' match case; as I suggested when
> commenting your patch tweaking this part. :-)
>
> Well, from my point of view, the alternative is:
>
> a)
> (match ref
> (('tag-or-commit . commit)
> (channel (inherit c)
> (url url) (commit commit) (branch #f)))
> (('branch . branch)
> (channel (inherit c)
> (url url) (commit #f) (branch branch)))
> (#f
> (channel (inherit c) (url url))))
>
> or b)
> (match ref
> ((or ('commit . commit)
> ('tag-or-commit . commit)
> ('tag . commit))
> (channel (inherit c)
> (url url) (commit commit) (branch #f)))
> (('branch . branch)
> (channel (inherit c)
> (url url) (commit #f) (branch branch)))
> (#f
> (channel (inherit c) (url url)))))
>
> but not ecab937897385fce3e3ce0c5f128afba4304187c. :-)
I was driven by my use case where adding support for tag-or-commit was
enough, but I think it'd be a good idea to cover all the potential ref
types documented in update-cached-checkout, so b) makes sense to me.
--
Thanks,
Maxim
This bug report was last modified 1 year and 242 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.