Re: [PATCH v2 8/8] fetch-pack: implement ref-in-want
- From
- Brandon Williams <bmwill@google.com>
- Date
- Jun 14, 2018, 21:18 UTC
- Message-ID
- <20180614211842.GA68349@google.com>
- In-Reply-To
- <CAGZ79kZGV7NeYGpt=BJTASZYva3pyY-2CxMmDMXXxuZeg4sfjQ@mail.gmail.com>
On 06/14, Stefan Beller wrote:
Show 19 quoted lines
> On Wed, Jun 13, 2018 at 2:39 PM Brandon Williams <bmwill@google.com> wrote:
>
> > +static void receive_wanted_refs(struct packet_reader *reader, struct ref *refs)
> > +{
> ...
> > +
> > + for (r = refs; r; r = r->next) {
> > + if (!strcmp(end, r->name)) {
> > + oidcpy(&r->old_oid, &oid);
> > + break;
> > + }
> > + }
>
> The server is documented as MUST NOT send additional refs,
> which is fine here, as we'd have no way of storing them anyway.
> Do we want to issue a warning, though?
>
> if (!r) /* never break'd */
> warning ("server send unexpected line '%s'", reader.line);Depends, does this warning help out the end user or do you think it would confuse users to see this and still have their fetch succeed?
Show 26 quoted lines
>
>
>
> > diff --git a/remote.c b/remote.c
> > index abe80c139..c9d452ac0 100644
> > --- a/remote.c
> > +++ b/remote.c
> > @@ -1735,6 +1735,7 @@ int get_fetch_map(const struct ref *remote_refs,
> > if (refspec->exact_sha1) {
> > ref_map = alloc_ref(name);
> > get_oid_hex(name, &ref_map->old_oid);
> > + ref_map->exact_sha1 = 1;
> > } else {
> > ref_map = get_remote_ref(remote_refs, name);
> > }
> > diff --git a/remote.h b/remote.h
> > index 45ecc6cef..e5338e368 100644
> > --- a/remote.h
> > +++ b/remote.h
> > @@ -73,6 +73,7 @@ struct ref {
> > force:1,
> > forced_update:1,
> > expect_old_sha1:1,
> > + exact_sha1:1,
>
> Can we rename that to exact_oid ?I'll fix this.
-- Brandon Williams