diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2020-08-17 21:01:34 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-18 13:25:05 -0700 |
commit | abcb7eeb31d0267ada469646be993ad25e127d0d (patch) | |
tree | 984cd41c305b201a0190545fc6787c74ee77c7ad /sequencer.c | |
parent | fetch: avoid reading submodule config until needed (diff) | |
download | tgif-abcb7eeb31d0267ada469646be993ad25e127d0d.tar.xz |
fetch: only populate existing_refs if needed
In "fetch", get_ref_map() iterates over all refs to populate
"existing_refs" in order to populate peer_ref->old_oid in the returned
refmap, even if the refmap has no peer_ref set - which is the case when
only literal hashes (i.e. no refs by name) are fetched.
Iterating over refs causes the targets of those refs to be checked for
existence. Avoiding this is especially important when we use "git fetch"
to perform lazy fetches in a partial clone because a target of such a
ref may need to be itself lazy-fetched (and otherwise causing an
infinite loop).
Therefore, avoid populating "existing_refs" until necessary. With this
patch, because Git lazy-fetches objects by literal hashes (to be done in
a subsequent commit), it will then be able to guarantee avoiding reading
targets of refs.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
0 files changed, 0 insertions, 0 deletions