Re: [PATCH v2 8/8] fetch-pack: implement ref-in-want
From: Brandon Williams <hidden>
Date: 2018-06-14 21:18:49
On 06/14, Stefan Beller wrote:
On Wed, Jun 13, 2018 at 2:39 PM Brandon Williams [off-list ref] wrote:quoted
+static void receive_wanted_refs(struct packet_reader *reader, struct ref *refs) +{...quoted
+ + 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?
quoted
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