{"thread":{"id":"50002","subject":"[PATCH v1 0/8] Many promisor remotes","startedAt":"2018-12-11T05:28:08Z","lastAt":"2018-12-11T05:28:22Z","messageCount":9,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"365028","messageId":"20181211052746.16218-1-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":null,"subject":"[PATCH v1 0/8] Many promisor remotes","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:38Z","receivedAt":"2018-12-11T05:28:08Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This path series is a follow up from the \"remote odb\" patch series\nthat I sent earlier this year, which were a follow up from previous\nseries. See the links section for more information.\n\nThe goal of this patch series is to make it possible to have and to\nfetch missing objects from multiple remotes instead of only one.\n\nFor now the fetch order is the order of the remotes in the config.\n\nI selected the name \"Promisor remote\" over \"Partial clone remote\"\nbecause it is shorter and because it is not only about cloning.\n\nThe existing extensions.partialclone is respected, but it is not\nwritten in the config when a partial clone or fetch is made. Instead\nremote.<name>.promisor is set to \"true\". This may create a\ncompatibility issue, but it makes it possible to start using many\npromisor remotes by just cloning and fetching from different remotes\nwith partial clone filters. The compatibility issue could be resolved\nin a future iteration by just setting extensions.partialclone instead\nof remote.<name>.promisor the first time a promisor remote is used.\n\nIn general I have tried to change as few things as possible.\n\nYeah, this is missing documentation for now.\n\nHigh level overview of this patch series\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n  - Patch 1/8:\n\nThis makes functions in fetch-object.c return an error code, which is\nnecessary to later tell that they failed and try another promisor\nremote when there is more than one. This could also just be seen as a\nfix to these functions.\n\n  - Patch 2/8:\n\nThis introduces the minimum infrastructure for promisor remotes.\n\n  - Patch 3/8, 4/8 and 5/8:\n\nThis add a few missing bits in the promisor remote infrastructure that\nwill be needed in the following patches.\n\n  - Patch 6/8:\n\nThis replaces the previous interface to use only one promisor remote\ndefined in extensions.partialclone by the new interface created by the\nprevious patches.\n\n  - Patch 7/8:\n\nThis replaces the way a partial clone filter was handled by a new way\nbased on the previous patches that support more than one partial clone\nfilter.\n\n  - Patch 8/8:\n\nThis adds a test case that shows that now more than one promisor\nremote can be used.\n\nLinks\n~~~~~\n\nThis new patch series is a follow up from the discussions related to\nthe remote odb V4 patch series:\n\nhttps://public-inbox.org/git/20180802061505.2983-1-chriscool@tuxfamily.org/\n\nEspecially in:\n\nhttps://public-inbox.org/git/CAP8UFD3nrhjANwNDqTwx5ZtnZNcnbAFqUN=u=LrvzuH4+3wQQA@mail.gmail.com/\n\nI said that I would like to work on things in the following order:\n\n  1) Teaching partial clone to attempt to fetch missing objects from\nmultiple remotes instead of only one using the order in the config.\n\n  2) Simplifying the protocol for fetching missing objects so that it\ncan be satisfied by a lighter weight object storage system than a full\nGit server.\n\n  3) Making it possible to explicitly define an order in which the\nremotes are accessed.\n\n  4) Making the criteria for what objects can be missing more\naggressive, so that I can \"git add\" a large file and work with it\nusing Git without even having a second copy of that object in my local\nobject store.\n\nAnd this patch series is about the 1).\n\nThis patch series on GitHub:\n\nhttps://github.com/chriscool/git/commits/many-promisor-remotes\n\nThe previous remote odb patch series on GitHub:\n\nV5: https://github.com/chriscool/git/commits/remote-odb\nV4: https://github.com/chriscool/git/commits/remote-odb5\nV3: https://github.com/chriscool/git/commits/remote-odb3\nV2: https://github.com/chriscool/git/commits/remote-odb2\nV1: https://github.com/chriscool/git/commits/remote-odb1\n\nDiscussions related to previous versions of the odb patch series:\n\nV4: https://public-inbox.org/git/20180802061505.2983-1-chriscool@tuxfamily.org/\nV3: https://public-inbox.org/git/20180713174959.16748-1-chriscool@tuxfamily.org/\nV2: https://public-inbox.org/git/20180630083542.20347-1-chriscool@tuxfamily.org/\nV1: https://public-inbox.org/git/20180623121846.19750-1-chriscool@tuxfamily.org/\n\n\n\nChristian Couder (8):\n  fetch-object: make functions return an error code\n  Add initial support for many promisor remotes\n  promisor-remote: implement promisors_get_direct()\n  promisor-remote: add promisor_remote_reinit()\n  promisor-remote: use repository_format_partial_clone\n  Use promisors_get_direct() and has_promisor_remote()\n  promisor-remote: parse remote.*.partialclonefilter\n  t0410: test fetching from many promisor remotes\n\n Makefile                      |   1 +\n builtin/cat-file.c            |   5 +-\n builtin/fetch.c               |  13 +--\n builtin/gc.c                  |   3 +-\n builtin/repack.c              |   3 +-\n cache-tree.c                  |   3 +-\n connected.c                   |   3 +-\n fetch-object.c                |  13 +--\n fetch-object.h                |   4 +-\n list-objects-filter-options.c |  51 ++++++------\n list-objects-filter-options.h |   3 +-\n packfile.c                    |   3 +-\n promisor-remote.c             | 147 ++++++++++++++++++++++++++++++++++\n promisor-remote.h             |  22 +++++\n sha1-file.c                   |  14 ++--\n t/t0410-partial-clone.sh      |  26 +++++-\n t/t5601-clone.sh              |   3 +-\n t/t5616-partial-clone.sh      |   4 +-\n unpack-trees.c                |   6 +-\n 19 files changed, 269 insertions(+), 58 deletions(-)\n create mode 100644 promisor-remote.c\n create mode 100644 promisor-remote.h\n\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365029","messageId":"20181211052746.16218-2-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 1/8] fetch-object: make functions return an error code","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:39Z","receivedAt":"2018-12-11T05:28:10Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: Christian Couder <christian.couder@gmail.com>\n\nThe callers of the fetch_object() and fetch_objects() might\nbe interested in knowing if these functions succeeded or not.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n fetch-object.c | 13 ++++++++-----\n fetch-object.h |  4 ++--\n sha1-file.c    |  4 ++--\n 3 files changed, 12 insertions(+), 9 deletions(-)\n\ndiff --git a/fetch-object.c b/fetch-object.c\nindex 4266548800..eac4d448ef 100644\n--- a/fetch-object.c\n+++ b/fetch-object.c\n@@ -5,11 +5,12 @@\n #include \"transport.h\"\n #include \"fetch-object.h\"\n \n-static void fetch_refs(const char *remote_name, struct ref *ref)\n+static int fetch_refs(const char *remote_name, struct ref *ref)\n {\n \tstruct remote *remote;\n \tstruct transport *transport;\n \tint original_fetch_if_missing = fetch_if_missing;\n+\tint res;\n \n \tfetch_if_missing = 0;\n \tremote = remote_get(remote_name);\n@@ -19,12 +20,14 @@ static void fetch_refs(const char *remote_name, struct ref *ref)\n \n \ttransport_set_option(transport, TRANS_OPT_FROM_PROMISOR, \"1\");\n \ttransport_set_option(transport, TRANS_OPT_NO_DEPENDENTS, \"1\");\n-\ttransport_fetch_refs(transport, ref);\n+\tres = transport_fetch_refs(transport, ref);\n \tfetch_if_missing = original_fetch_if_missing;\n+\n+\treturn res;\n }\n \n-void fetch_objects(const char *remote_name, const struct object_id *oids,\n-\t\t   int oid_nr)\n+int fetch_objects(const char *remote_name, const struct object_id *oids,\n+\t\t  int oid_nr)\n {\n \tstruct ref *ref = NULL;\n \tint i;\n@@ -36,5 +39,5 @@ void fetch_objects(const char *remote_name, const struct object_id *oids,\n \t\tnew_ref->next = ref;\n \t\tref = new_ref;\n \t}\n-\tfetch_refs(remote_name, ref);\n+\treturn fetch_refs(remote_name, ref);\n }\ndiff --git a/fetch-object.h b/fetch-object.h\nindex d6444caa5a..7bcc7cadb0 100644\n--- a/fetch-object.h\n+++ b/fetch-object.h\n@@ -3,7 +3,7 @@\n \n struct object_id;\n \n-void fetch_objects(const char *remote_name, const struct object_id *oids,\n-\t\t   int oid_nr);\n+int fetch_objects(const char *remote_name, const struct object_id *oids,\n+\t\t  int oid_nr);\n \n #endif\ndiff --git a/sha1-file.c b/sha1-file.c\nindex 5bd11c85bc..cf88eeb147 100644\n--- a/sha1-file.c\n+++ b/sha1-file.c\n@@ -1312,8 +1312,8 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,\n \t\tif (fetch_if_missing && repository_format_partial_clone &&\n \t\t    !already_retried && r == the_repository) {\n \t\t\t/*\n-\t\t\t * TODO Investigate having fetch_object() return\n-\t\t\t * TODO error/success and stopping the music here.\n+\t\t\t * TODO Investigate checking fetch_object() return\n+\t\t\t * TODO value and stopping on error here.\n \t\t\t * TODO Pass a repository struct through fetch_object,\n \t\t\t * such that arbitrary repositories work.\n \t\t\t */\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365030","messageId":"20181211052746.16218-4-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 3/8] promisor-remote: implement promisors_get_direct()","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:41Z","receivedAt":"2018-12-11T05:28:13Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: Christian Couder <christian.couder@gmail.com>\n\nThis is implemented for now by calling fetch_objects(). It fetches\nfrom all the promisor remotes.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n promisor-remote.c | 33 +++++++++++++++++++++++++++++++++\n promisor-remote.h |  1 +\n 2 files changed, 34 insertions(+)\n\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex 701f5a351b..e0724bdc20 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"promisor-remote.h\"\n #include \"config.h\"\n+#include \"fetch-object.h\"\n \n static struct promisor_remote *promisors;\n static struct promisor_remote **promisors_tail = &promisors;\n@@ -88,3 +89,35 @@ int has_promisor_remote(void)\n {\n \treturn !!find_promisor_remote(NULL);\n }\n+\n+static int promisor_remote_get_direct(struct promisor_remote *o,\n+\t\t\t\t      const struct object_id *oids,\n+\t\t\t\t      int oid_nr)\n+{\n+\tint res;\n+\tuint64_t start = getnanotime();\n+\n+\tres = fetch_objects(o->remote_name, oids, oid_nr);\n+\n+\ttrace_performance_since(start, \"promisor_remote_get_direct\");\n+\n+\treturn res;\n+}\n+\n+int promisors_get_direct(const struct object_id *oids, int oid_nr)\n+{\n+\tstruct promisor_remote *o;\n+\n+\ttrace_printf(\"trace: promisor_remote_get_direct: nr: %d\", oid_nr);\n+\n+\tpromisor_remote_init();\n+\n+\tfor (o = promisors; o; o = o->next) {\n+\t\tif (promisor_remote_get_direct(o, oids, oid_nr) < 0)\n+\t\t\tcontinue;\n+\t\treturn 0;\n+\t}\n+\n+\treturn -1;\n+}\n+\ndiff --git a/promisor-remote.h b/promisor-remote.h\nindex d07ac07a43..8b89221b33 100644\n--- a/promisor-remote.h\n+++ b/promisor-remote.h\n@@ -13,5 +13,6 @@ struct promisor_remote {\n extern struct promisor_remote *promisor_remote_new(const char *remote_name);\n extern struct promisor_remote *find_promisor_remote(const char *remote_name);\n extern int has_promisor_remote(void);\n+extern int promisors_get_direct(const struct object_id *oids, int oid_nr);\n \n #endif /* PROMISOR_REMOTE_H */\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365031","messageId":"20181211052746.16218-5-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 4/8] promisor-remote: add promisor_remote_reinit()","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:42Z","receivedAt":"2018-12-11T05:28:14Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: Christian Couder <christian.couder@gmail.com>\n\nWe will need to reinitialize the promisor remote configuration\nas we will make some changes to it in a later commit.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n promisor-remote.c | 14 ++++++++++++--\n promisor-remote.h |  1 +\n 2 files changed, 13 insertions(+), 2 deletions(-)\n\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex e0724bdc20..ca2b8bf6bb 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -64,17 +64,27 @@ static int promisor_remote_config(const char *var, const char *value, void *data\n \treturn 0;\n }\n \n-static void promisor_remote_init(void)\n+static void promisor_remote_do_init(int force)\n {\n \tstatic int initialized;\n \n-\tif (initialized)\n+\tif (!force && initialized)\n \t\treturn;\n \tinitialized = 1;\n \n \tgit_config(promisor_remote_config, NULL);\n }\n \n+static inline void promisor_remote_init(void)\n+{\n+\tpromisor_remote_do_init(0);\n+}\n+\n+void promisor_remote_reinit(void)\n+{\n+\tpromisor_remote_do_init(1);\n+}\n+\n struct promisor_remote *find_promisor_remote(const char *remote_name)\n {\n \tpromisor_remote_init();\ndiff --git a/promisor-remote.h b/promisor-remote.h\nindex 8b89221b33..873ddfb5ed 100644\n--- a/promisor-remote.h\n+++ b/promisor-remote.h\n@@ -10,6 +10,7 @@ struct promisor_remote {\n \tstruct promisor_remote *next;\n };\n \n+extern void promisor_remote_reinit(void);\n extern struct promisor_remote *promisor_remote_new(const char *remote_name);\n extern struct promisor_remote *find_promisor_remote(const char *remote_name);\n extern int has_promisor_remote(void);\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365032","messageId":"20181211052746.16218-6-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 5/8] promisor-remote: use repository_format_partial_clone","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:43Z","receivedAt":"2018-12-11T05:28:16Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"A remote specified using the extensions.partialClone config\noption should be considered a promisor remote too.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n promisor-remote.c | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex ca2b8bf6bb..e4a0625426 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -73,6 +73,11 @@ static void promisor_remote_do_init(int force)\n \tinitialized = 1;\n \n \tgit_config(promisor_remote_config, NULL);\n+\n+\tif (repository_format_partial_clone &&\n+\t    !do_find_promisor_remote(repository_format_partial_clone))\n+\t\tpromisor_remote_new(repository_format_partial_clone,\n+\t\t\t\t    strlen(repository_format_partial_clone));\n }\n \n static inline void promisor_remote_init(void)\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365033","messageId":"20181211052746.16218-3-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 2/8] Add initial support for many promisor remotes","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:40Z","receivedAt":"2018-12-11T05:28:17Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: Christian Couder <christian.couder@gmail.com>\n\nThe promisor-remote.{c,h} files will contain functions to\nmanage many promisor remotes.\n\nWe expect that there will not be a lot of promisor remotes,\nso it is ok to use a simple linked list to manage them.\n\nHelped-by: Jeff King <peff@peff.net>\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n Makefile          |  1 +\n promisor-remote.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++\n promisor-remote.h | 17 +++++++++\n 3 files changed, 108 insertions(+)\n create mode 100644 promisor-remote.c\n create mode 100644 promisor-remote.h\n\ndiff --git a/Makefile b/Makefile\nindex 1a44c811aa..565a5fbb4e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -949,6 +949,7 @@ LIB_OBJS += preload-index.o\n LIB_OBJS += pretty.o\n LIB_OBJS += prio-queue.o\n LIB_OBJS += progress.o\n+LIB_OBJS += promisor-remote.o\n LIB_OBJS += prompt.o\n LIB_OBJS += protocol.o\n LIB_OBJS += quote.o\ndiff --git a/promisor-remote.c b/promisor-remote.c\nnew file mode 100644\nindex 0000000000..701f5a351b\n--- /dev/null\n+++ b/promisor-remote.c\n@@ -0,0 +1,90 @@\n+#include \"cache.h\"\n+#include \"promisor-remote.h\"\n+#include \"config.h\"\n+\n+static struct promisor_remote *promisors;\n+static struct promisor_remote **promisors_tail = &promisors;\n+\n+struct promisor_remote *promisor_remote_new(const char *remote_name)\n+{\n+\tstruct promisor_remote *o;\n+\n+\to = xcalloc(1, sizeof(*o));\n+\to->remote_name = xstrdup(remote_name);\n+\n+\t*promisors_tail = o;\n+\tpromisors_tail = &o->next;\n+\n+\treturn o;\n+}\n+\n+static struct promisor_remote *do_find_promisor_remote(const char *remote_name)\n+{\n+\tstruct promisor_remote *o;\n+\n+\tfor (o = promisors; o; o = o->next)\n+\t\tif (o->remote_name && !strcmp(o->remote_name, remote_name))\n+\t\t\treturn o;\n+\n+\treturn NULL;\n+}\n+\n+static int promisor_remote_config(const char *var, const char *value, void *data)\n+{\n+\tstruct promisor_remote *o;\n+\tconst char *name;\n+\tint namelen;\n+\tconst char *subkey;\n+\n+\tif (parse_config_key(var, \"remote\", &name, &namelen, &subkey) < 0)\n+\t\treturn 0;\n+\n+\tif (!strcmp(subkey, \"promisor\")) {\n+\t\tchar *remote_name;\n+\n+\t\tif (!git_config_bool(var, value))\n+\t\t\treturn 0;\n+\n+\t\tremote_name = xmemdupz(name, namelen);\n+\n+\t\tif (do_find_promisor_remote(remote_name)) {\n+\t\t\tfree(remote_name);\n+\t\t\treturn error(_(\"when parsing config key '%s' \"\n+\t\t\t\t       \"promisor remote '%s' already exists\"),\n+\t\t\t\t     var, remote_name);\n+\t\t}\n+\n+\t\tpromisor_remote_new(remote_name);\n+\n+\t\tfree(remote_name);\n+\t\treturn 0;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void promisor_remote_init(void)\n+{\n+\tstatic int initialized;\n+\n+\tif (initialized)\n+\t\treturn;\n+\tinitialized = 1;\n+\n+\tgit_config(promisor_remote_config, NULL);\n+}\n+\n+struct promisor_remote *find_promisor_remote(const char *remote_name)\n+{\n+\tpromisor_remote_init();\n+\n+\tif (!remote_name)\n+\t\treturn promisors;\n+\n+\treturn do_find_promisor_remote(remote_name);\n+}\n+\n+int has_promisor_remote(void)\n+{\n+\treturn !!find_promisor_remote(NULL);\n+}\ndiff --git a/promisor-remote.h b/promisor-remote.h\nnew file mode 100644\nindex 0000000000..d07ac07a43\n--- /dev/null\n+++ b/promisor-remote.h\n@@ -0,0 +1,17 @@\n+#ifndef PROMISOR_REMOTE_H\n+#define PROMISOR_REMOTE_H\n+\n+/*\n+ * Promisor remote linked list\n+ * Its information come from remote.XXX config entries.\n+ */\n+struct promisor_remote {\n+\tconst char *remote_name;\n+\tstruct promisor_remote *next;\n+};\n+\n+extern struct promisor_remote *promisor_remote_new(const char *remote_name);\n+extern struct promisor_remote *find_promisor_remote(const char *remote_name);\n+extern int has_promisor_remote(void);\n+\n+#endif /* PROMISOR_REMOTE_H */\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365035","messageId":"20181211052746.16218-8-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 7/8] promisor-remote: parse remote.*.partialclonefilter","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:45Z","receivedAt":"2018-12-11T05:28:19Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This makes it possible to specify a different partial clone\nfilter for each promisor remote.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin/fetch.c               |  2 +-\n list-objects-filter-options.c | 27 +++++++++++++++------------\n list-objects-filter-options.h |  3 ++-\n promisor-remote.c             | 13 +++++++++++--\n promisor-remote.h             |  5 ++++-\n t/t0410-partial-clone.sh      |  2 +-\n t/t5601-clone.sh              |  1 +\n t/t5616-partial-clone.sh      |  2 +-\n 8 files changed, 36 insertions(+), 19 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 647a60b26c..53494c5864 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -1489,7 +1489,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)\n \t * the config.\n \t */\n \tif (!filter_options.choice)\n-\t\tpartial_clone_get_default_filter_spec(&filter_options);\n+\t\tpartial_clone_get_default_filter_spec(&filter_options, remote->name);\n \treturn;\n }\n \ndiff --git a/list-objects-filter-options.c b/list-objects-filter-options.c\nindex 3b5ff55480..ea0148f709 100644\n--- a/list-objects-filter-options.c\n+++ b/list-objects-filter-options.c\n@@ -29,6 +29,9 @@ static int gently_parse_list_objects_filter(\n {\n \tconst char *v0;\n \n+\tif (!arg)\n+\t\treturn 0;\n+\n \tif (filter_options->choice) {\n \t\tif (errbuf) {\n \t\t\tstrbuf_addstr(\n@@ -127,6 +130,7 @@ void partial_clone_register(\n \tconst struct list_objects_filter_options *filter_options)\n {\n \tchar *cfg_name;\n+\tchar *filter_name;\n \n \t/* Check if it is already registered */\n \tif (!find_promisor_remote(remote)) {\n@@ -141,27 +145,26 @@ void partial_clone_register(\n \t/*\n \t * Record the initial filter-spec in the config as\n \t * the default for subsequent fetches from this remote.\n-\t *\n-\t * TODO: record it into remote.<name>.partialclonefilter\n \t */\n-\tcore_partial_clone_filter_default =\n-\t\txstrdup(filter_options->filter_spec);\n-\tgit_config_set(\"core.partialclonefilter\",\n-\t\t       core_partial_clone_filter_default);\n+\tfilter_name = xstrfmt(\"remote.%s.partialclonefilter\", remote);\n+\tgit_config_set(filter_name, filter_options->filter_spec);\n+\tfree(filter_name);\n \n \t/* Make sure the config info are reset */\n \tpromisor_remote_reinit();\n }\n \n void partial_clone_get_default_filter_spec(\n-\tstruct list_objects_filter_options *filter_options)\n+\tstruct list_objects_filter_options *filter_options,\n+\tconst char *remote)\n {\n+\tstruct promisor_remote *promisor = find_promisor_remote(remote);\n+\n \t/*\n \t * Parse default value, but silently ignore it if it is invalid.\n \t */\n-\tif (!core_partial_clone_filter_default)\n-\t\treturn;\n-\tgently_parse_list_objects_filter(filter_options,\n-\t\t\t\t\t core_partial_clone_filter_default,\n-\t\t\t\t\t NULL);\n+\tif (promisor)\n+\t\tgently_parse_list_objects_filter(filter_options,\n+\t\t\t\t\t\t promisor->partial_clone_filter,\n+\t\t\t\t\t\t NULL);\n }\ndiff --git a/list-objects-filter-options.h b/list-objects-filter-options.h\nindex af64e5c66f..8c10ec2d3a 100644\n--- a/list-objects-filter-options.h\n+++ b/list-objects-filter-options.h\n@@ -75,6 +75,7 @@ void partial_clone_register(\n \tconst char *remote,\n \tconst struct list_objects_filter_options *filter_options);\n void partial_clone_get_default_filter_spec(\n-\tstruct list_objects_filter_options *filter_options);\n+\tstruct list_objects_filter_options *filter_options,\n+\tconst char *remote);\n \n #endif /* LIST_OBJECTS_FILTER_OPTIONS_H */\ndiff --git a/promisor-remote.c b/promisor-remote.c\nindex e4a0625426..d1bd9fbf49 100644\n--- a/promisor-remote.c\n+++ b/promisor-remote.c\n@@ -60,6 +60,16 @@ static int promisor_remote_config(const char *var, const char *value, void *data\n \t\tfree(remote_name);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(subkey, \"partialclonefilter\")) {\n+\t\tchar *remote_name = xmemdupz(name, namelen);\n+\n+\t\to = do_find_promisor_remote(remote_name);\n+\t\tif (!o)\n+\t\t\to = promisor_remote_new(remote_name);\n+\n+\t\tfree(remote_name);\n+\t\treturn git_config_string(&o->partial_clone_filter, var, value);\n+\t}\n \n \treturn 0;\n }\n@@ -76,8 +86,7 @@ static void promisor_remote_do_init(int force)\n \n \tif (repository_format_partial_clone &&\n \t    !do_find_promisor_remote(repository_format_partial_clone))\n-\t\tpromisor_remote_new(repository_format_partial_clone,\n-\t\t\t\t    strlen(repository_format_partial_clone));\n+\t\tpromisor_remote_new(repository_format_partial_clone);\n }\n \n static inline void promisor_remote_init(void)\ndiff --git a/promisor-remote.h b/promisor-remote.h\nindex 873ddfb5ed..431edafcdd 100644\n--- a/promisor-remote.h\n+++ b/promisor-remote.h\n@@ -3,10 +3,13 @@\n \n /*\n  * Promisor remote linked list\n- * Its information come from remote.XXX config entries.\n+ *\n+ * Information in its fields come from remote.XXX config entries or\n+ * from extensions.partialclone or core.partialclonefilter.\n  */\n struct promisor_remote {\n \tconst char *remote_name;\n+\tconst char *partial_clone_filter;\n \tstruct promisor_remote *next;\n };\n \ndiff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh\nindex ba3887f178..462229e445 100755\n--- a/t/t0410-partial-clone.sh\n+++ b/t/t0410-partial-clone.sh\n@@ -26,7 +26,7 @@ promise_and_delete () {\n test_expect_success 'extensions.partialclone without filter' '\n \ttest_create_repo server &&\n \tgit clone --filter=\"blob:none\" \"file://$(pwd)/server\" client &&\n-\tgit -C client config --unset core.partialclonefilter &&\n+\tgit -C client config --unset remote.origin.partialclonefilter &&\n \tgit -C client fetch origin\n '\n \ndiff --git a/t/t5601-clone.sh b/t/t5601-clone.sh\nindex aafe55b8b7..72a04669e4 100755\n--- a/t/t5601-clone.sh\n+++ b/t/t5601-clone.sh\n@@ -654,6 +654,7 @@ partial_clone () {\n \n \t# Ensure that unneeded blobs are not inadvertently fetched.\n \ttest_config -C client remote.origin.promisor \"false\" &&\n+\tgit -C client config --unset remote.origin.partialclonefilter &&\n \ttest_must_fail git -C client cat-file -e \"$HASH1\" &&\n \n \t# But this blob was fetched, because clone performs an initial checkout\ndiff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh\nindex d09dee1f14..9057ad25d3 100755\n--- a/t/t5616-partial-clone.sh\n+++ b/t/t5616-partial-clone.sh\n@@ -43,7 +43,7 @@ test_expect_success 'do partial clone 1' '\n \ttest_cmp expect_1.oids observed.oids &&\n \ttest \"$(git -C pc1 config --local core.repositoryformatversion)\" = \"1\" &&\n \ttest \"$(git -C pc1 config --local remote.origin.promisor)\" = \"true\" &&\n-\ttest \"$(git -C pc1 config --local core.partialclonefilter)\" = \"blob:none\"\n+\ttest \"$(git -C pc1 config --local remote.origin.partialclonefilter)\" = \"blob:none\"\n '\n \n # checkout master to force dynamic object fetch of blobs at HEAD.\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365034","messageId":"20181211052746.16218-9-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 8/8] t0410: test fetching from many promisor remotes","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:46Z","receivedAt":"2018-12-11T05:28:21Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"From: Christian Couder <christian.couder@gmail.com>\n\nThis shows that it is now possible to fetch objects from more\nthan one promisor remote.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/t0410-partial-clone.sh | 24 +++++++++++++++++++++++-\n 1 file changed, 23 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh\nindex 462229e445..a09a53ab0d 100755\n--- a/t/t0410-partial-clone.sh\n+++ b/t/t0410-partial-clone.sh\n@@ -182,8 +182,30 @@ test_expect_success 'fetching of missing objects works with ref-in-want enabled'\n \tgrep \"git< fetch=.*ref-in-want\" trace\n '\n \n+test_expect_success 'fetching of missing objects from another promisor remote' '\n+\tgit clone \"file://$(pwd)/server\" server2 &&\n+\ttest_commit -C server2 bar &&\n+\tgit -C server2 repack -a -d --write-bitmap-index &&\n+\tHASH2=$(git -C server2 rev-parse bar) &&\n+\n+\tgit -C repo remote add server2 \"file://$(pwd)/server2\" &&\n+\tgit -C repo config remote.server2.promisor true &&\n+\tgit -C repo cat-file -p \"$HASH2\" &&\n+\n+\tgit -C repo fetch server2 &&\n+\trm -rf repo/.git/objects/* &&\n+\tgit -C repo cat-file -p \"$HASH2\" &&\n+\n+\t# Ensure that the .promisor file is written, and check that its\n+\t# associated packfile contains the object\n+\tls repo/.git/objects/pack/pack-*.promisor >promisorlist &&\n+\ttest_line_count = 1 promisorlist &&\n+\tIDX=$(cat promisorlist | sed \"s/promisor$/idx/\") &&\n+\tgit verify-pack --verbose \"$IDX\" | grep \"$HASH2\"\n+'\n+\n test_expect_success 'fetching of missing blobs works' '\n-\trm -rf server repo &&\n+\trm -rf server server2 repo &&\n \ttest_create_repo server &&\n \ttest_commit -C server foo &&\n \tgit -C server repack -a -d --write-bitmap-index &&\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"},{"id":"365036","messageId":"20181211052746.16218-7-chriscool@tuxfamily.org","threadId":"50002","inReplyTo":"20181211052746.16218-1-chriscool@tuxfamily.org","subject":"[PATCH v1 6/8] Use promisors_get_direct() and has_promisor_remote()","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-12-11T05:27:44Z","receivedAt":"2018-12-11T05:28:22Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Instead of using the repository_format_partial_clone global\nand fetch_objects() directly, let's use has_promisor_remote()\nand promisors_get_direct().\n\nThis way all the configured promisor remotes will be taken\ninto account, not only the one specified by\nextensions.partialClone.\n\nAlso when cloning or fetching using a partial clone filter,\nremote.origin.promisor will be set to \"true\" instead of\nsetting extensions.partialClone to \"origin\". This makes it\npossible to use many promisor remote just by fetching from\nthem.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n builtin/cat-file.c            |  5 +++--\n builtin/fetch.c               | 11 ++++++-----\n builtin/gc.c                  |  3 ++-\n builtin/repack.c              |  3 ++-\n cache-tree.c                  |  3 ++-\n connected.c                   |  3 ++-\n list-objects-filter-options.c | 28 +++++++++++++++-------------\n packfile.c                    |  3 ++-\n sha1-file.c                   | 14 ++++++++------\n t/t5601-clone.sh              |  2 +-\n t/t5616-partial-clone.sh      |  2 +-\n unpack-trees.c                |  6 +++---\n 12 files changed, 47 insertions(+), 36 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 2ca56fd086..bdb0331ba4 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -14,6 +14,7 @@\n #include \"sha1-array.h\"\n #include \"packfile.h\"\n #include \"object-store.h\"\n+#include \"promisor-remote.h\"\n \n struct batch_options {\n \tint enabled;\n@@ -517,8 +518,8 @@ static int batch_objects(struct batch_options *opt)\n \tif (opt->all_objects) {\n \t\tstruct object_cb_data cb;\n \n-\t\tif (repository_format_partial_clone)\n-\t\t\twarning(\"This repository has extensions.partialClone set. Some objects may not be loaded.\");\n+\t\tif (has_promisor_remote())\n+\t\t\twarning(\"This repository uses promisor remotes. Some objects may not be loaded.\");\n \n \t\tcb.opt = opt;\n \t\tcb.expand = &data;\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex e0140327aa..647a60b26c 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -23,6 +23,7 @@\n #include \"packfile.h\"\n #include \"list-objects-filter-options.h\"\n #include \"commit-reach.h\"\n+#include \"promisor-remote.h\"\n \n static const char * const builtin_fetch_usage[] = {\n \tN_(\"git fetch [<options>] [<repository> [<refspec>...]]\"),\n@@ -1459,7 +1460,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)\n \t * If no prior partial clone/fetch and the current fetch DID NOT\n \t * request a partial-fetch, do a normal fetch.\n \t */\n-\tif (!repository_format_partial_clone && !filter_options.choice)\n+\tif (!has_promisor_remote() && !filter_options.choice)\n \t\treturn;\n \n \t/*\n@@ -1467,7 +1468,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)\n \t * on this repo and remember the given filter-spec as the default\n \t * for subsequent fetches to this remote.\n \t */\n-\tif (!repository_format_partial_clone && filter_options.choice) {\n+\tif (!has_promisor_remote() && filter_options.choice) {\n \t\tpartial_clone_register(remote->name, &filter_options);\n \t\treturn;\n \t}\n@@ -1476,7 +1477,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)\n \t * We are currently limited to only ONE promisor remote and only\n \t * allow partial-fetches from the promisor remote.\n \t */\n-\tif (strcmp(remote->name, repository_format_partial_clone)) {\n+\tif (!find_promisor_remote(remote->name)) {\n \t\tif (filter_options.choice)\n \t\t\tdie(_(\"--filter can only be used with the remote configured in core.partialClone\"));\n \t\treturn;\n@@ -1607,7 +1608,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)\n \tif (depth || deepen_since || deepen_not.nr)\n \t\tdeepen = 1;\n \n-\tif (filter_options.choice && !repository_format_partial_clone)\n+\tif (filter_options.choice && !has_promisor_remote())\n \t\tdie(\"--filter can only be used when extensions.partialClone is set\");\n \n \tif (all) {\n@@ -1641,7 +1642,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (remote) {\n-\t\tif (filter_options.choice || repository_format_partial_clone)\n+\t\tif (filter_options.choice || has_promisor_remote())\n \t\t\tfetch_one_setup_partial(remote);\n \t\tresult = fetch_one(remote, argc, argv, prune_tags_ok);\n \t} else {\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 871a56f1c5..42dfa3a23c 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -27,6 +27,7 @@\n #include \"pack-objects.h\"\n #include \"blob.h\"\n #include \"tree.h\"\n+#include \"promisor-remote.h\"\n \n #define FAILED_RUN \"failed to run %s\"\n \n@@ -640,7 +641,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n \t\t\targv_array_push(&prune, prune_expire);\n \t\t\tif (quiet)\n \t\t\t\targv_array_push(&prune, \"--no-progress\");\n-\t\t\tif (repository_format_partial_clone)\n+\t\t\tif (has_promisor_remote())\n \t\t\t\targv_array_push(&prune,\n \t\t\t\t\t\t\"--exclude-promisor-objects\");\n \t\t\tif (run_command_v_opt(prune.argv, RUN_GIT_CMD))\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 45583683ee..26e02e3135 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -11,6 +11,7 @@\n #include \"midx.h\"\n #include \"packfile.h\"\n #include \"object-store.h\"\n+#include \"promisor-remote.h\"\n \n static int delta_base_offset = 1;\n static int pack_kept_objects = -1;\n@@ -366,7 +367,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \targv_array_push(&cmd.args, \"--all\");\n \targv_array_push(&cmd.args, \"--reflog\");\n \targv_array_push(&cmd.args, \"--indexed-objects\");\n-\tif (repository_format_partial_clone)\n+\tif (has_promisor_remote())\n \t\targv_array_push(&cmd.args, \"--exclude-promisor-objects\");\n \tif (write_bitmaps)\n \t\targv_array_push(&cmd.args, \"--write-bitmap-index\");\ndiff --git a/cache-tree.c b/cache-tree.c\nindex 9d454d24bc..a1ecb2a1fa 100644\n--- a/cache-tree.c\n+++ b/cache-tree.c\n@@ -5,6 +5,7 @@\n #include \"cache-tree.h\"\n #include \"object-store.h\"\n #include \"replace-object.h\"\n+#include \"promisor-remote.h\"\n \n #ifndef DEBUG\n #define DEBUG 0\n@@ -357,7 +358,7 @@ static int update_one(struct cache_tree *it,\n \t\t}\n \n \t\tce_missing_ok = mode == S_IFGITLINK || missing_ok ||\n-\t\t\t(repository_format_partial_clone &&\n+\t\t\t(has_promisor_remote() &&\n \t\t\t ce_skip_worktree(ce));\n \t\tif (is_null_oid(oid) ||\n \t\t    (!ce_missing_ok && !has_object_file(oid))) {\ndiff --git a/connected.c b/connected.c\nindex 1bba888eff..0eaaedee6a 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -4,6 +4,7 @@\n #include \"connected.h\"\n #include \"transport.h\"\n #include \"packfile.h\"\n+#include \"promisor-remote.h\"\n \n /*\n  * If we feed all the commits we want to verify to this command\n@@ -56,7 +57,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,\n \targv_array_push(&rev_list.args,\"rev-list\");\n \targv_array_push(&rev_list.args, \"--objects\");\n \targv_array_push(&rev_list.args, \"--stdin\");\n-\tif (repository_format_partial_clone)\n+\tif (has_promisor_remote())\n \t\targv_array_push(&rev_list.args, \"--exclude-promisor-objects\");\n \tif (!opt->is_deepening_fetch) {\n \t\targv_array_push(&rev_list.args, \"--not\");\ndiff --git a/list-objects-filter-options.c b/list-objects-filter-options.c\nindex e8da2e8581..3b5ff55480 100644\n--- a/list-objects-filter-options.c\n+++ b/list-objects-filter-options.c\n@@ -6,6 +6,7 @@\n #include \"list-objects.h\"\n #include \"list-objects-filter.h\"\n #include \"list-objects-filter-options.h\"\n+#include \"promisor-remote.h\"\n \n /*\n  * Parse value of the argument to the \"filter\" keyword.\n@@ -125,30 +126,31 @@ void partial_clone_register(\n \tconst char *remote,\n \tconst struct list_objects_filter_options *filter_options)\n {\n-\t/*\n-\t * Record the name of the partial clone remote in the\n-\t * config and in the global variable -- the latter is\n-\t * used throughout to indicate that partial clone is\n-\t * enabled and to expect missing objects.\n-\t */\n-\tif (repository_format_partial_clone &&\n-\t    *repository_format_partial_clone &&\n-\t    strcmp(remote, repository_format_partial_clone))\n-\t\tdie(_(\"cannot change partial clone promisor remote\"));\n+\tchar *cfg_name;\n \n-\tgit_config_set(\"core.repositoryformatversion\", \"1\");\n-\tgit_config_set(\"extensions.partialclone\", remote);\n+\t/* Check if it is already registered */\n+\tif (!find_promisor_remote(remote)) {\n+\t\tgit_config_set(\"core.repositoryformatversion\", \"1\");\n \n-\trepository_format_partial_clone = xstrdup(remote);\n+\t\t/* Add promisor config for the remote */\n+\t\tcfg_name = xstrfmt(\"remote.%s.promisor\", remote);\n+\t\tgit_config_set(cfg_name, \"true\");\n+\t\tfree(cfg_name);\n+\t}\n \n \t/*\n \t * Record the initial filter-spec in the config as\n \t * the default for subsequent fetches from this remote.\n+\t *\n+\t * TODO: record it into remote.<name>.partialclonefilter\n \t */\n \tcore_partial_clone_filter_default =\n \t\txstrdup(filter_options->filter_spec);\n \tgit_config_set(\"core.partialclonefilter\",\n \t\t       core_partial_clone_filter_default);\n+\n+\t/* Make sure the config info are reset */\n+\tpromisor_remote_reinit();\n }\n \n void partial_clone_get_default_filter_spec(\ndiff --git a/packfile.c b/packfile.c\nindex d1e6683ffe..7aaeea7693 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -16,6 +16,7 @@\n #include \"tree.h\"\n #include \"object-store.h\"\n #include \"midx.h\"\n+#include \"promisor-remote.h\"\n \n char *odb_pack_name(struct strbuf *buf,\n \t\t    const unsigned char *sha1,\n@@ -2113,7 +2114,7 @@ int is_promisor_object(const struct object_id *oid)\n \tstatic int promisor_objects_prepared;\n \n \tif (!promisor_objects_prepared) {\n-\t\tif (repository_format_partial_clone) {\n+\t\tif (has_promisor_remote()) {\n \t\t\tfor_each_packed_object(add_promisor_object,\n \t\t\t\t\t       &promisor_objects,\n \t\t\t\t\t       FOR_EACH_OBJECT_PROMISOR_ONLY);\ndiff --git a/sha1-file.c b/sha1-file.c\nindex cf88eeb147..f1acaa3254 100644\n--- a/sha1-file.c\n+++ b/sha1-file.c\n@@ -32,6 +32,7 @@\n #include \"packfile.h\"\n #include \"fetch-object.h\"\n #include \"object-store.h\"\n+#include \"promisor-remote.h\"\n \n /* The maximum size for an object header. */\n #define MAX_HEADER_LEN 32\n@@ -1309,15 +1310,16 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,\n \t\t}\n \n \t\t/* Check if it is a missing object */\n-\t\tif (fetch_if_missing && repository_format_partial_clone &&\n+\t\tif (fetch_if_missing && has_promisor_remote() &&\n \t\t    !already_retried && r == the_repository) {\n \t\t\t/*\n-\t\t\t * TODO Investigate checking fetch_object() return\n-\t\t\t * TODO value and stopping on error here.\n-\t\t\t * TODO Pass a repository struct through fetch_object,\n-\t\t\t * such that arbitrary repositories work.\n+\t\t\t * TODO Investigate checking promisors_get_direct()\n+\t\t\t * TODO return value and stopping on error here.\n+\t\t\t * TODO Pass a repository struct through\n+\t\t\t * promisors_get_direct(), such that arbitrary\n+\t\t\t * repositories work.\n \t\t\t */\n-\t\t\tfetch_objects(repository_format_partial_clone, real, 1);\n+\t\t\tpromisors_get_direct(real, 1);\n \t\t\talready_retried = 1;\n \t\t\tcontinue;\n \t\t}\ndiff --git a/t/t5601-clone.sh b/t/t5601-clone.sh\nindex 8bbc7068ac..aafe55b8b7 100755\n--- a/t/t5601-clone.sh\n+++ b/t/t5601-clone.sh\n@@ -653,7 +653,7 @@ partial_clone () {\n \tgit -C client fsck &&\n \n \t# Ensure that unneeded blobs are not inadvertently fetched.\n-\ttest_config -C client extensions.partialclone \"not a remote\" &&\n+\ttest_config -C client remote.origin.promisor \"false\" &&\n \ttest_must_fail git -C client cat-file -e \"$HASH1\" &&\n \n \t# But this blob was fetched, because clone performs an initial checkout\ndiff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh\nindex 336f02a41a..d09dee1f14 100755\n--- a/t/t5616-partial-clone.sh\n+++ b/t/t5616-partial-clone.sh\n@@ -42,7 +42,7 @@ test_expect_success 'do partial clone 1' '\n \n \ttest_cmp expect_1.oids observed.oids &&\n \ttest \"$(git -C pc1 config --local core.repositoryformatversion)\" = \"1\" &&\n-\ttest \"$(git -C pc1 config --local extensions.partialclone)\" = \"origin\" &&\n+\ttest \"$(git -C pc1 config --local remote.origin.promisor)\" = \"true\" &&\n \ttest \"$(git -C pc1 config --local core.partialclonefilter)\" = \"blob:none\"\n '\n \ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 7570df481b..9ad157eeab 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -18,6 +18,7 @@\n #include \"fsmonitor.h\"\n #include \"object-store.h\"\n #include \"fetch-object.h\"\n+#include \"promisor-remote.h\"\n \n /*\n  * Error messages expected by scripts out of plumbing commands such as\n@@ -418,7 +419,7 @@ static int check_updates(struct unpack_trees_options *o)\n \t\tload_gitmodules_file(index, &state);\n \n \tenable_delayed_checkout(&state);\n-\tif (repository_format_partial_clone && o->update && !o->dry_run) {\n+\tif (has_promisor_remote() && o->update && !o->dry_run) {\n \t\t/*\n \t\t * Prefetch the objects that are to be checked out in the loop\n \t\t * below.\n@@ -435,8 +436,7 @@ static int check_updates(struct unpack_trees_options *o)\n \t\t\t}\n \t\t}\n \t\tif (to_fetch.nr)\n-\t\t\tfetch_objects(repository_format_partial_clone,\n-\t\t\t\t      to_fetch.oid, to_fetch.nr);\n+\t\t\tpromisors_get_direct(to_fetch.oid, to_fetch.nr);\n \t\tfetch_if_missing = fetch_if_missing_store;\n \t\toid_array_clear(&to_fetch);\n \t}\n-- \n2.20.0.rc2.14.g1379de12fa.dirty\n\n"}]}