Re: [PATCH v2 8/8] fetch-pack: implement ref-in-want
- From
Stefan Beller <sbeller@google.com>
- Date
- Jun 14, 2018, 19:56 UTC
- Message-ID
- <CAGZ79kZGV7NeYGpt=BJTASZYva3pyY-2CxMmDMXXxuZeg4sfjQ@mail.gmail.com>
- In-Reply-To
- <20180613213925.10560-9-bmwill@google.com>
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)
> +{...
Show 7 quoted lines
> +
> + 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);Show 21 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 ? (bonus points for also converting expect_old_sha1)
Thanks, Stefan