Subject: [PATCH 1/2] fetch-pack: remove fetch_if_missing=0

From: "Hariom Verma via GitGitGadget" <[email-masked]>
Date: Mon, 20 Apr 2020 19:54:36 +0000

From: Hariom Verma <[email-masked]>

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 <[email-masked]>
---
 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 dc1485c8aa1..38a45512918 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 1734a573b01..1ca643f6491 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,
-- 
gitgitgadget