From e362fadcd03753471cf8e7fc91d6d721b7423b8f Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Tue, 12 Nov 2019 16:34:19 -0800 Subject: clone: remove fetch_if_missing=0 Commit 6462d5eb9a ("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 clone as well. But doing so reveals a bug - when the server does not send an object directly pointed to by a ref, this should be an error, not a trigger for a lazy fetch. (This case in the fetching mechanism was covered by a test using "git clone", not "git fetch", which is why the aforementioned commit didn't uncover the bug.) The bug can be fixed by suppressing lazy-fetching during the connectivity check. Fix this bug, and remove fetch_if_missing from clone. Signed-off-by: Jonathan Tan Signed-off-by: Junio C Hamano --- connected.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'connected.c') diff --git a/connected.c b/connected.c index 36c4e5dedb..c337f5f7f4 100644 --- a/connected.c +++ b/connected.c @@ -62,7 +62,8 @@ int check_connected(oid_iterate_fn fn, void *cb_data, * received the objects pointed to by each wanted ref. */ do { - if (!repo_has_object_file(the_repository, &oid)) + if (!repo_has_object_file_with_flags(the_repository, &oid, + OBJECT_INFO_SKIP_FETCH_OBJECT)) return 1; } while (!fn(cb_data, &oid)); return 0; -- cgit v1.2.3