git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 03/11] promisor-remote: implement promisor_remote_get_direct()

From
Christian Couder <christian.couder@gmail.com>
Date
Mar 12, 2019, 13:29 UTC
Message-ID
<20190312132959.11764-4-chriscool@tuxfamily.org>
In-Reply-To
<20190312132959.11764-1-chriscool@tuxfamily.org>
From: Christian Couder <christian.couder@gmail.com>

This is implemented for now by calling fetch_objects(). It fetches from all the promisor remotes.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 promisor-remote.c | 17 +++++++++++++++++
 promisor-remote.h |  1 +
 2 files changed, 18 insertions(+)
diff --git a/promisor-remote.c b/promisor-remote.c
index d2f574651e..f86f9d0b84 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "promisor-remote.h"
 #include "config.h"
+#include "fetch-object.h"
 
 static struct promisor_remote *promisors;
 static struct promisor_remote **promisors_tail = &promisors;
@@ -98,3 +99,19 @@ int has_promisor_remote(void)
 {
 	return !!promisor_remote_find(NULL);
 }
+
+int promisor_remote_get_direct(const struct object_id *oids, int oid_nr)
+{
+	struct promisor_remote *o;
+
+	promisor_remote_init();
+
+	for (o = promisors; o; o = o->next) {
+		if (fetch_objects(o->remote_name, oids, oid_nr) < 0)
+			continue;
+		return 0;
+	}
+
+	return -1;
+}
+
diff --git a/promisor-remote.h b/promisor-remote.h
index bfbf7c0f21..f9f5825417 100644
--- a/promisor-remote.h
+++ b/promisor-remote.h
@@ -13,5 +13,6 @@ struct promisor_remote {
 extern struct promisor_remote *promisor_remote_new(const char *remote_name);
 extern struct promisor_remote *promisor_remote_find(const char *remote_name);
 extern int has_promisor_remote(void);
+extern int promisor_remote_get_direct(const struct object_id *oids, int oid_nr);
 
 #endif /* PROMISOR_REMOTE_H */
-- 
2.21.0.166.gb5e4dbcfd3
Previous: Christian CouderNext: Junio C Hamano
Message 3 of 22 in “Many promisor remotes”
  1. 00/11 Many promisor remotesChristian Couder, Mar 12, 2019
  2. 01/11 fetch-object: make functions return an error codeChristian Couder, Mar 12, 2019
  3. 03/11 promisor-remote: implement promisor_remote_get_direct()Christian Couder, Mar 12, 2019
  4. Junio C HamanoMar 13, 2019
  5. Christian CouderApr 1, 2019
  6. 02/11 Add initial support for many promisor remotesChristian Couder, Mar 12, 2019
  7. Junio C HamanoMar 13, 2019
  8. Junio C HamanoMar 13, 2019
  9. Christian CouderApr 1, 2019
  10. 04/11 promisor-remote: add promisor_remote_reinit()Christian Couder, Mar 12, 2019
  11. Junio C HamanoMar 13, 2019
  12. Christian CouderApr 1, 2019
  13. 05/11 promisor-remote: use repository_format_partial_cloneChristian Couder, Mar 12, 2019
  14. Junio C HamanoMar 13, 2019
  15. Christian CouderApr 1, 2019
  16. Junio C HamanoApr 1, 2019
  17. 07/11 promisor-remote: parse remote.*.partialclonefilterChristian Couder, Mar 12, 2019
  18. 08/11 builtin/fetch: remove unique promisor remote limitationChristian Couder, Mar 12, 2019
  19. 06/11 Use promisor_remote_get_direct() and has_promisor_remote()Christian Couder, Mar 12, 2019
  20. 09/11 t0410: test fetching from many promisor remotesChristian Couder, Mar 12, 2019
  21. 10/11 partial-clone: add multiple remotes in the docChristian Couder, Mar 12, 2019
  22. 11/11 remote: add promisor and partial clone config to the docChristian Couder, Mar 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.