transport: do not list refs if possible
When all refs to be fetched are exact OIDs, it is possible to perform a fetch without requiring the remote to list refs if protocol v2 is used. Teach Git to do this. This currently has an effect only for lazy fetches done from partial clones. The change necessary to likewise optimize "git fetch <remote> <sha-1>" will be done in a subsequent patch. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
99bcb883cb
commit
0177565148
@ -1598,7 +1598,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
|
||||
if (nr_sought)
|
||||
nr_sought = remove_duplicates_in_refs(sought, nr_sought);
|
||||
|
||||
if (!ref) {
|
||||
if (version != protocol_v2 && !ref) {
|
||||
packet_flush(fd[1]);
|
||||
die(_("no matching remote head"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user