clone: always set transport options
commit643f918d13906cbccdc5ad188767fc7895e30fc1
authorJeff King <peff@peff.net>
Wed, 18 Sep 2013 20:35:13 +0000 (18 16:35 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Sep 2013 21:36:40 +0000 (18 14:36 -0700)
treed7896325086bc80f5ee80002e78fcf8b44815d22
parent2856cbf0ae604c233e7dc62ba7931a469165ce4f
clone: always set transport options

A clone will always create a transport struct, whether we
are cloning locally or using an actual protocol. In the
local case, we only use the transport to get the list of
refs, and then transfer the objects out-of-band.

However, there are many options that we do not bother
setting up in the local case. For the most part, these are
noops, because they only affect the object-fetching stage
(e.g., the --depth option).  However, some options do have a
visible impact. For example, giving the path to upload-pack
via "-u" does not currently work for a local clone, even
though we need upload-pack to get the ref list.

We can just drop the conditional entirely and set these
options for both local and non-local clones. Rather than
keep track of which options impact the object versus the ref
fetching stage, we can simply let the noops be noops (and
the cost of setting the options in the first place is not
high).

The one exception is that we also check that the transport
provides both a "get_refs_list" and a "fetch" method. We
will now be checking the former for both cases (which is
good, since a transport that cannot fetch refs would not
work for a local clone), and we tweak the conditional to
check for a "fetch" only when we are non-local.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
t/t5701-clone-local.sh