aboutsummaryrefslogtreecommitdiffstats
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-09-27 12:24:05 -0700
committerJunio C Hamano <gitster@pobox.com>2018-10-07 09:53:15 +0900
commit01775651481ecd9c7288a85cfb7999f7f38ab37c (patch)
tree3e2dfaec7103a81426e4d8dd3a7e16ddd6fa0587 /fetch-pack.c
parent99bcb883cb2bd2d27939a831a66d794770427e98 (diff)
downloadgit-01775651481ecd9c7288a85cfb7999f7f38ab37c.tar.gz
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>
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 75047a4b2a..15652b4776 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -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"));
}