fetch: do not list refs if fetching only hashes
authorJonathan Tan <jonathantanmy@google.com>
Thu, 27 Sep 2018 19:24:07 +0000 (12:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 7 Oct 2018 00:53:21 +0000 (09:53 +0900)
commite70a3030e747312327a4f3619247bf8a986aa577
tree595256e117267f0dd72e9e7c75104efc9fd62dd4
parent6ab4055775b0e560d1f2a1be2e7251d872874655
fetch: do not list refs if fetching only hashes

If only hash literals are given on a "git fetch" command-line, tag
following is not requested, and the fetch is done using protocol v2, a
list of refs is not required from the remote. Therefore, optimize by
invoking transport_get_remote_refs() only if we need the refs.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
t/t5551-http-fetch-smart.sh
t/t5702-protocol-v2.sh