From eb0cbeeeed080596c130f657186894999ae6121b Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Thu, 16 Apr 2020 17:27:50 +0530 Subject: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0 Commit 6462d5e ("fetch: remove fetch_if_missing=0", 2019-11-08) strove to remove the need for fetch_if_missing=0 from the fetching mechanism, so it is plausible to attempt removing fetch_if_missing=0 from fetch-pack as well. Signed-off-by: Hariom Verma --- builtin/fetch-pack.c | 2 -- fetch-pack.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index dc1485c8aa1bf2..38a45512918071 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -57,8 +57,6 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix) struct packet_reader reader; enum protocol_version version; - fetch_if_missing = 0; - packet_trace_identity("fetch-pack"); memset(&args, 0, sizeof(args)); diff --git a/fetch-pack.c b/fetch-pack.c index 1734a573b010dd..1ca643f6491dca 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -1649,7 +1649,7 @@ static void update_shallow(struct fetch_pack_args *args, struct oid_array extra = OID_ARRAY_INIT; struct object_id *oid = si->shallow->oid; for (i = 0; i < si->shallow->nr; i++) - if (has_object_file(&oid[i])) + if (has_object_file_with_flags(&oid[i], OBJECT_INFO_SKIP_FETCH_OBJECT)) oid_array_append(&extra, &oid[i]); if (extra.nr) { setup_alternate_shallow(&shallow_lock, From 82f7473d3b8225771bbf09023ad2b5b787261dd0 Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Sun, 19 Apr 2020 21:16:54 +0530 Subject: [PATCH 2/2] index-pack: remove fetch_if_missing=0 Commit 6462d5e ("fetch: remove fetch_if_missing=0", 2019-11-08) strove to remove the need for fetch_if_missing=0 from the fetching mechanism, so it is plausible to attempt removing fetch_if_missing=0 from index-pack as well. Signed-off-by: Hariom Verma --- builtin/index-pack.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/builtin/index-pack.c b/builtin/index-pack.c index d967d188a307fe..9847baaf3f4dcd 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -782,7 +782,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry, if (startup_info->have_repository) { read_lock(); collision_test_needed = - has_object_file_with_flags(oid, OBJECT_INFO_QUICK); + has_object_file_with_flags(oid, OBJECT_INFO_QUICK | + OBJECT_INFO_SKIP_FETCH_OBJECT); read_unlock(); } @@ -1673,14 +1674,6 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix) unsigned foreign_nr = 1; /* zero is a "good" value, assume bad */ int report_end_of_input = 0; - /* - * index-pack never needs to fetch missing objects except when - * REF_DELTA bases are missing (which are explicitly handled). It only - * accesses the repo to do hash collision checks and to check which - * REF_DELTA bases need to be fetched. - */ - fetch_if_missing = 0; - if (argc == 2 && !strcmp(argv[1], "-h")) usage(index_pack_usage);