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

[PATCH v5 15/16] Move repository_format_partial_clone to promisor-remote.c

From
Christian Couder <christian.couder@gmail.com>
Date
Apr 9, 2019, 16:11 UTC
Message-ID
<20190409161116.30256-16-chriscool@tuxfamily.org>
In-Reply-To
<20190409161116.30256-1-chriscool@tuxfamily.org>

Now that we have has_promisor_remote() and can use many promisor remotes, let's hide repository_format_partial_clone as a static in promisor-remote.c to avoid it being use for anything other than managing backward compatibility.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 cache.h           | 1 -
 environment.c     | 1 -
 promisor-remote.c | 7 +++++++
 promisor-remote.h | 6 ++++++
 setup.c           | 3 ++-
 5 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/cache.h b/cache.h
index e928fe9d3b..217e434d5d 100644
--- a/cache.h
+++ b/cache.h
@@ -960,7 +960,6 @@ extern int grafts_replace_parents;
 #define GIT_REPO_VERSION 0
 #define GIT_REPO_VERSION_READ 1
 extern int repository_format_precious_objects;
-extern char *repository_format_partial_clone;
 extern const char *core_partial_clone_filter_default;
 extern int repository_format_worktree_config;
 
diff --git a/environment.c b/environment.c
index 89af47cb85..8855d2fc11 100644
--- a/environment.c
+++ b/environment.c
@@ -31,7 +31,6 @@ int warn_ambiguous_refs = 1;
 int warn_on_object_refname_ambiguity = 1;
 int ref_paranoia = -1;
 int repository_format_precious_objects;
-char *repository_format_partial_clone;
 const char *core_partial_clone_filter_default;
 int repository_format_worktree_config;
 const char *git_commit_encoding;
diff --git a/promisor-remote.c b/promisor-remote.c
index 066489b637..371c78385f 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -4,6 +4,13 @@
 #include "config.h"
 #include "transport.h"
 
+static char *repository_format_partial_clone;
+
+void set_repository_format_partial_clone(char *partial_clone)
+{
+	repository_format_partial_clone = xstrdup_or_null(partial_clone);
+}
+
 static int fetch_refs(const char *remote_name, struct ref *ref)
 {
 	struct remote *remote;
diff --git a/promisor-remote.h b/promisor-remote.h
index 562c7ad8a4..c3c07c2a23 100644
--- a/promisor-remote.h
+++ b/promisor-remote.h
@@ -20,4 +20,10 @@ 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);
 
+/*
+ * This should be used only once from setup.c to set the value we got
+ * from the extensions.partialclone config option.
+ */
+extern void set_repository_format_partial_clone(char *partial_clone);
+
 #endif /* PROMISOR_REMOTE_H */
diff --git a/setup.c b/setup.c
index d0c958c3b2..434628706b 100644
--- a/setup.c
+++ b/setup.c
@@ -4,6 +4,7 @@
 #include "dir.h"
 #include "string-list.h"
 #include "chdir-notify.h"
+#include "promisor-remote.h"
 
 static int inside_git_dir = -1;
 static int inside_work_tree = -1;
@@ -477,7 +478,7 @@ static int check_repository_format_gently(const char *gitdir, struct repository_
 	}
 
 	repository_format_precious_objects = candidate->precious_objects;
-	repository_format_partial_clone = xstrdup_or_null(candidate->partial_clone);
+	set_repository_format_partial_clone(candidate->partial_clone);
 	repository_format_worktree_config = candidate->worktree_config;
 	string_list_clear(&candidate->unknown_extensions, 0);
 
-- 
2.21.0.750.g68c8ebb2ac
Previous: Christian CouderNext: Christian Couder
Message 23 of 28 in “Many promisor remotes”
  1. 00/16 Many promisor remotesChristian Couder, Apr 9, 2019
  2. 01/16 t0410: remove pipes after git commandsChristian Couder, Apr 9, 2019
  3. 02/16 fetch-object: make functions return an error codeChristian Couder, Apr 9, 2019
  4. 03/16 Add initial support for many promisor remotesChristian Couder, Apr 9, 2019
  5. 05/16 promisor-remote: add promisor_remote_reinit()Christian Couder, Apr 9, 2019
  6. 06/16 promisor-remote: use repository_format_partial_cloneChristian Couder, Apr 9, 2019
  7. 04/16 promisor-remote: implement promisor_remote_get_direct()Christian Couder, Apr 9, 2019
  8. Derrick StoleeMay 30, 2019
  9. Johannes SchindelinMay 30, 2019
  10. Derrick StoleeMay 30, 2019
  11. Johannes SchindelinMay 31, 2019
  12. Junio C HamanoMay 31, 2019
  13. Christian CouderMay 31, 2019
  14. Christian CouderJun 25, 2019
  15. 07/16 Use promisor_remote_get_direct() and has_promisor_remote()Christian Couder, Apr 9, 2019
  16. 08/16 diff: use promisor-remote.h instead of fetch-object.hChristian Couder, Apr 9, 2019
  17. 09/16 promisor-remote: parse remote.*.partialclonefilterChristian Couder, Apr 9, 2019
  18. 10/16 builtin/fetch: remove unique promisor remote limitationChristian Couder, Apr 9, 2019
  19. 12/16 partial-clone: add multiple remotes in the docChristian Couder, Apr 9, 2019
  20. 11/16 t0410: test fetching from many promisor remotesChristian Couder, Apr 9, 2019
  21. 13/16 remote: add promisor and partial clone config to the docChristian Couder, Apr 9, 2019
  22. 14/16 Remove fetch-object.{c,h} in favor of promisor-remote.{c,h}Christian Couder, Apr 9, 2019
  23. 15/16 Move repository_format_partial_clone to promisor-remote.cChristian Couder, Apr 9, 2019
  24. 16/16 Move core_partial_clone_filter_default to promisor-remote.cChristian Couder, Apr 9, 2019
  25. Junio C HamanoApr 15, 2019
  26. Junio C HamanoApr 15, 2019
  27. Christian CouderApr 15, 2019
  28. Christian CouderApr 15, 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.