summaryrefslogtreecommitdiff
path: root/promisor-remote.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2019-11-13 00:34:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-13 02:50:58 (GMT)
commit603960b50edeb1f0afa694f2f0283e553c031129 (patch)
tree22ad03c602452032557113d7a0d9622d2a54e9d2 /promisor-remote.c
parente362fadcd03753471cf8e7fc91d6d721b7423b8f (diff)
downloadgit-603960b50edeb1f0afa694f2f0283e553c031129.zip
git-603960b50edeb1f0afa694f2f0283e553c031129.tar.gz
git-603960b50edeb1f0afa694f2f0283e553c031129.tar.bz2
promisor-remote: 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 the lazy-fetching mechanism in promisor-remote as well. But doing so reveals a bug - when the server does not send an object pointed to by a tag object, an infinite loop occurs: Git attempts to fetch the missing object, which causes a deferencing of all refs (for negotiation), which causes a lazy fetch of that missing object, and so on. This bug is because of unnecessary use of the fetch negotiator during lazy fetching - it is not used after initialization, but it is still initialized (which causes the dereferencing of all refs). Thus, when the negotiator is not used during fetching, refrain from initializing it. Then, remove fetch_if_missing from promisor-remote. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'promisor-remote.c')
-rw-r--r--promisor-remote.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/promisor-remote.c b/promisor-remote.c
index 9bd5b79..9f338c9 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -16,10 +16,8 @@ static int fetch_refs(const char *remote_name, struct ref *ref)
{
struct remote *remote;
struct transport *transport;
- int original_fetch_if_missing = fetch_if_missing;
int res;
- fetch_if_missing = 0;
remote = remote_get(remote_name);
if (!remote->url[0])
die(_("Remote with no URL"));
@@ -28,7 +26,6 @@ static int fetch_refs(const char *remote_name, struct ref *ref)
transport_set_option(transport, TRANS_OPT_FROM_PROMISOR, "1");
transport_set_option(transport, TRANS_OPT_NO_DEPENDENTS, "1");
res = transport_fetch_refs(transport, ref);
- fetch_if_missing = original_fetch_if_missing;
return res;
}