summaryrefslogtreecommitdiff
path: root/sha1-file.c
diff options
context:
space:
mode:
authorLibravatar Jonathan Tan <jonathantanmy@google.com>2019-03-29 14:39:27 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-04-01 15:47:15 +0900
commit0f4a4fb1c4239a2aa46343add84ad6f99f6f3aae (patch)
tree64fc8e102e67f02a6ea922ad5debac1eb0bc1bac /sha1-file.c
parentThe third batch (diff)
downloadtgif-0f4a4fb1c4239a2aa46343add84ad6f99f6f3aae.tar.xz
sha1-file: support OBJECT_INFO_FOR_PREFETCH
Teach oid_object_info_extended() to support a new flag that inhibits fetching of missing objects. This is equivalent to setting fetch_is_missing to 0, calling oid_object_info_extended(), then setting fetch_if_missing to whatever it was before. Update unpack-trees.c to use this new flag instead of repeatedly setting fetch_if_missing. This new flag complicates things slightly in that there are now 2 ways to do the same thing. But this eliminates the need to repeatedly set a global variable, and more importantly, allows prefetching to be done in parallel (in the future); hence, this patch. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1-file.c')
-rw-r--r--sha1-file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1-file.c b/sha1-file.c
index 494606f771..ad02649124 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -1370,7 +1370,8 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,
/* Check if it is a missing object */
if (fetch_if_missing && repository_format_partial_clone &&
- !already_retried && r == the_repository) {
+ !already_retried && r == the_repository &&
+ !(flags & OBJECT_INFO_FOR_PREFETCH)) {
/*
* TODO Investigate having fetch_object() return
* TODO error/success and stopping the music here.