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

[PATCH v2 14/21] repo-settings: split out declarations into a standalone header

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 30, 2024, 09:09 UTC
Message-ID
<0d7365c5190aabdf33990e36154d1807f199ed91.1725008898.git.ps@pks.im>
In-Reply-To
<cover.1725008897.git.ps@pks.im>

While we have "repo-settings.c", we do not have a corresponding "repo-settings.h" file. Instead, this functionality is part of the "repository.h" header, making it hard to discover.

Split the declarations out of "repository.h" and create a standalone header file with them.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 repo-settings.c |  1 +
 repo-settings.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
 repository.h    | 51 +-------------------------------------------
 3 files changed, 58 insertions(+), 50 deletions(-)
 create mode 100644 repo-settings.h
diff --git a/repo-settings.c b/repo-settings.c
index 2b4e68731be..6165546e80a 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -1,5 +1,6 @@
 #include "git-compat-util.h"
 #include "config.h"
+#include "repo-settings.h"
 #include "repository.h"
 #include "midx.h"
 
diff --git a/repo-settings.h b/repo-settings.h
new file mode 100644
index 00000000000..ff20a965373
--- /dev/null
+++ b/repo-settings.h
@@ -0,0 +1,56 @@
+#ifndef REPO_SETTINGS_H
+#define REPO_SETTINGS_H
+
+struct fsmonitor_settings;
+struct repository;
+
+enum untracked_cache_setting {
+	UNTRACKED_CACHE_KEEP,
+	UNTRACKED_CACHE_REMOVE,
+	UNTRACKED_CACHE_WRITE,
+};
+
+enum fetch_negotiation_setting {
+	FETCH_NEGOTIATION_CONSECUTIVE,
+	FETCH_NEGOTIATION_SKIPPING,
+	FETCH_NEGOTIATION_NOOP,
+};
+
+struct repo_settings {
+	int initialized;
+
+	int core_commit_graph;
+	int commit_graph_generation_version;
+	int commit_graph_changed_paths_version;
+	int gc_write_commit_graph;
+	int fetch_write_commit_graph;
+	int command_requires_full_index;
+	int sparse_index;
+	int pack_read_reverse_index;
+	int pack_use_bitmap_boundary_traversal;
+	int pack_use_multi_pack_reuse;
+
+	/*
+	 * Does this repository have core.useReplaceRefs=true (on by
+	 * default)? This provides a repository-scoped version of this
+	 * config, though it could be disabled process-wide via some Git
+	 * builtins or the --no-replace-objects option. See
+	 * replace_refs_enabled() for more details.
+	 */
+	int read_replace_refs;
+
+	struct fsmonitor_settings *fsmonitor; /* lazily loaded */
+
+	int index_version;
+	int index_skip_hash;
+	enum untracked_cache_setting core_untracked_cache;
+
+	int pack_use_sparse;
+	enum fetch_negotiation_setting fetch_negotiation_algorithm;
+
+	int core_multi_pack_index;
+};
+
+void prepare_repo_settings(struct repository *r);
+
+#endif /* REPO_SETTINGS_H */
diff --git a/repository.h b/repository.h
index c603e969ae7..24a66a496a6 100644
--- a/repository.h
+++ b/repository.h
@@ -2,9 +2,9 @@
 #define REPOSITORY_H
 
 #include "strmap.h"
+#include "repo-settings.h"
 
 struct config_set;
-struct fsmonitor_settings;
 struct git_hash_algo;
 struct index_state;
 struct lock_file;
@@ -14,59 +14,12 @@ struct submodule_cache;
 struct promisor_remote_config;
 struct remote_state;
 
-enum untracked_cache_setting {
-	UNTRACKED_CACHE_KEEP,
-	UNTRACKED_CACHE_REMOVE,
-	UNTRACKED_CACHE_WRITE,
-};
-
-enum fetch_negotiation_setting {
-	FETCH_NEGOTIATION_CONSECUTIVE,
-	FETCH_NEGOTIATION_SKIPPING,
-	FETCH_NEGOTIATION_NOOP,
-};
-
 enum ref_storage_format {
 	REF_STORAGE_FORMAT_UNKNOWN,
 	REF_STORAGE_FORMAT_FILES,
 	REF_STORAGE_FORMAT_REFTABLE,
 };
 
-struct repo_settings {
-	int initialized;
-
-	int core_commit_graph;
-	int commit_graph_generation_version;
-	int commit_graph_changed_paths_version;
-	int gc_write_commit_graph;
-	int fetch_write_commit_graph;
-	int command_requires_full_index;
-	int sparse_index;
-	int pack_read_reverse_index;
-	int pack_use_bitmap_boundary_traversal;
-	int pack_use_multi_pack_reuse;
-
-	/*
-	 * Does this repository have core.useReplaceRefs=true (on by
-	 * default)? This provides a repository-scoped version of this
-	 * config, though it could be disabled process-wide via some Git
-	 * builtins or the --no-replace-objects option. See
-	 * replace_refs_enabled() for more details.
-	 */
-	int read_replace_refs;
-
-	struct fsmonitor_settings *fsmonitor; /* lazily loaded */
-
-	int index_version;
-	int index_skip_hash;
-	enum untracked_cache_setting core_untracked_cache;
-
-	int pack_use_sparse;
-	enum fetch_negotiation_setting fetch_negotiation_algorithm;
-
-	int core_multi_pack_index;
-};
-
 struct repo_path_cache {
 	char *squash_msg;
 	char *merge_msg;
@@ -273,8 +226,6 @@ int repo_read_index_unmerged(struct repository *);
  */
 void repo_update_index_if_able(struct repository *, struct lock_file *);
 
-void prepare_repo_settings(struct repository *r);
-
 /*
  * Return 1 if upgrade repository format to target_version succeeded,
  * 0 if no upgrade is necessary, and -1 when upgrade is not possible.
-- 
2.46.0.421.g159f2d50e7.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 54 of 92 in “environment: guard reliance on `the_repository`”
  1. 00/21 environment: guard reliance on `the_repository`Patrick Steinhardt, Aug 29, 2024
  2. 01/21 environment: make `get_git_dir()` accept a repositoryPatrick Steinhardt, Aug 29, 2024
  3. Justin ToblerAug 29, 2024
  4. Patrick SteinhardtAug 30, 2024
  5. 02/21 environment: make `get_git_common_dir()` accept a repositoryPatrick Steinhardt, Aug 29, 2024
  6. 03/21 environment: make `get_object_directory()` accept a repositoryPatrick Steinhardt, Aug 29, 2024
  7. 04/21 environment: make `get_index_file()` accept a repositoryPatrick Steinhardt, Aug 29, 2024
  8. 05/21 environment: make `get_graft_file()` accept a repositoryPatrick Steinhardt, Aug 29, 2024
  9. 06/21 environment: make `get_git_work_tree()` accept a repositoryPatrick Steinhardt, Aug 29, 2024
  10. 07/21 config: document `read_early_config()` and `read_very_early_config()`Patrick Steinhardt, Aug 29, 2024
  11. 08/21 config: make dependency on repo in `read_early_config()` explicitPatrick Steinhardt, Aug 29, 2024
  12. 09/21 environment: move `odb_mkstemp()` into object layerPatrick Steinhardt, Aug 29, 2024
  13. 10/21 environment: make `get_git_namespace()` self-containedPatrick Steinhardt, Aug 29, 2024
  14. 11/21 environment: move `set_git_dir()` and related into setup layerPatrick Steinhardt, Aug 29, 2024
  15. 12/21 environment: reorder header to split out `the_repository`-free sectionPatrick Steinhardt, Aug 29, 2024
  16. 13/21 environment: guard state depending on a repositoryPatrick Steinhardt, Aug 29, 2024
  17. 14/21 repo-settings: split out declarations into a standalone headerPatrick Steinhardt, Aug 29, 2024
  18. 15/21 branch: stop modifying `log_all_ref_updates` variablePatrick Steinhardt, Aug 29, 2024
  19. 16/21 refs: stop modifying global `log_all_ref_updates` variablePatrick Steinhardt, Aug 29, 2024
  20. 17/21 repo-settings: track defaults close to `struct repo_settings`Patrick Steinhardt, Aug 29, 2024
  21. 18/21 environment: stop storing "core.logAllRefUpdates" globallyPatrick Steinhardt, Aug 29, 2024
  22. 19/21 environment: stop storing "core.preferSymlinkRefs" globallyPatrick Steinhardt, Aug 29, 2024
  23. 20/21 environment: stop storing "core.warnAmbiguousRefs" globallyPatrick Steinhardt, Aug 29, 2024
  24. 21/21 environment: stop storing "core.notesRef" globallyPatrick Steinhardt, Aug 29, 2024
  25. Junio C HamanoAug 29, 2024
  26. Patrick SteinhardtAug 30, 2024
  27. Junio C HamanoAug 30, 2024
  28. Patrick SteinhardtSep 2, 2024
  29. 00/21 environment: guard reliance on `the_repository`Patrick Steinhardt, Aug 30, 2024
  30. 01/21 environment: make `get_git_dir()` accept a repositoryPatrick Steinhardt, Aug 30, 2024
  31. karthik nayakSep 11, 2024
  32. Patrick SteinhardtSep 12, 2024
  33. 02/21 environment: make `get_git_common_dir()` accept a repositoryPatrick Steinhardt, Aug 30, 2024
  34. 03/21 environment: make `get_object_directory()` accept a repositoryPatrick Steinhardt, Aug 30, 2024
  35. 04/21 environment: make `get_index_file()` accept a repositoryPatrick Steinhardt, Aug 30, 2024
  36. 05/21 environment: make `get_graft_file()` accept a repositoryPatrick Steinhardt, Aug 30, 2024
  37. 06/21 environment: make `get_git_work_tree()` accept a repositoryPatrick Steinhardt, Aug 30, 2024
  38. Justin ToblerSep 11, 2024
  39. Patrick SteinhardtSep 12, 2024
  40. 07/21 config: document `read_early_config()` and `read_very_early_config()`Patrick Steinhardt, Aug 30, 2024
  41. Justin ToblerSep 11, 2024
  42. Patrick SteinhardtSep 12, 2024
  43. 08/21 config: make dependency on repo in `read_early_config()` explicitPatrick Steinhardt, Aug 30, 2024
  44. James LiuSep 4, 2024
  45. Patrick SteinhardtSep 4, 2024
  46. 09/21 environment: move `odb_mkstemp()` into object layerPatrick Steinhardt, Aug 30, 2024
  47. karthik nayakSep 11, 2024
  48. Patrick SteinhardtSep 12, 2024
  49. 10/21 environment: make `get_git_namespace()` self-containedPatrick Steinhardt, Aug 30, 2024
  50. Justin ToblerSep 11, 2024
  51. 11/21 environment: move `set_git_dir()` and related into setup layerPatrick Steinhardt, Aug 30, 2024
  52. 12/21 environment: reorder header to split out `the_repository`-free sectionPatrick Steinhardt, Aug 30, 2024
  53. 13/21 environment: guard state depending on a repositoryPatrick Steinhardt, Aug 30, 2024
  54. 14/21 repo-settings: split out declarations into a standalone headerPatrick Steinhardt, Aug 30, 2024
  55. 15/21 repo-settings: track defaults close to `struct repo_settings`Patrick Steinhardt, Aug 30, 2024
  56. 16/21 branch: stop modifying `log_all_ref_updates` variablePatrick Steinhardt, Aug 30, 2024
  57. Justin ToblerSep 11, 2024
  58. Patrick SteinhardtSep 12, 2024
  59. 17/21 refs: stop modifying global `log_all_ref_updates` variablePatrick Steinhardt, Aug 30, 2024
  60. 18/21 environment: stop storing "core.logAllRefUpdates" globallyPatrick Steinhardt, Aug 30, 2024
  61. karthik nayakSep 12, 2024
  62. 19/21 environment: stop storing "core.preferSymlinkRefs" globallyPatrick Steinhardt, Aug 30, 2024
  63. 20/21 environment: stop storing "core.warnAmbiguousRefs" globallyPatrick Steinhardt, Aug 30, 2024
  64. James LiuSep 4, 2024
  65. 21/21 environment: stop storing "core.notesRef" globallyPatrick Steinhardt, Aug 30, 2024
  66. James LiuSep 4, 2024
  67. Patrick SteinhardtSep 4, 2024
  68. karthik nayakSep 12, 2024
  69. Patrick SteinhardtSep 12, 2024
  70. 00/21 environment: guard reliance on `the_repository`Patrick Steinhardt, Sep 12, 2024
  71. 01/21 environment: make `get_git_dir()` accept a repositoryPatrick Steinhardt, Sep 12, 2024
  72. 02/21 environment: make `get_git_common_dir()` accept a repositoryPatrick Steinhardt, Sep 12, 2024
  73. 03/21 environment: make `get_object_directory()` accept a repositoryPatrick Steinhardt, Sep 12, 2024
  74. 04/21 environment: make `get_index_file()` accept a repositoryPatrick Steinhardt, Sep 12, 2024
  75. 05/21 environment: make `get_graft_file()` accept a repositoryPatrick Steinhardt, Sep 12, 2024
  76. 06/21 environment: make `get_git_work_tree()` accept a repositoryPatrick Steinhardt, Sep 12, 2024
  77. 07/21 config: document `read_early_config()` and `read_very_early_config()`Patrick Steinhardt, Sep 12, 2024
  78. 08/21 config: make dependency on repo in `read_early_config()` explicitPatrick Steinhardt, Sep 12, 2024
  79. 09/21 environment: move object database functions into object layerPatrick Steinhardt, Sep 12, 2024
  80. 10/21 environment: make `get_git_namespace()` self-containedPatrick Steinhardt, Sep 12, 2024
  81. 11/21 environment: move `set_git_dir()` and related into setup layerPatrick Steinhardt, Sep 12, 2024
  82. 12/21 environment: reorder header to split out `the_repository`-free sectionPatrick Steinhardt, Sep 12, 2024
  83. 13/21 environment: guard state depending on a repositoryPatrick Steinhardt, Sep 12, 2024
  84. 14/21 repo-settings: split out declarations into a standalone headerPatrick Steinhardt, Sep 12, 2024
  85. 15/21 repo-settings: track defaults close to `struct repo_settings`Patrick Steinhardt, Sep 12, 2024
  86. 16/21 branch: stop modifying `log_all_ref_updates` variablePatrick Steinhardt, Sep 12, 2024
  87. 17/21 refs: stop modifying global `log_all_ref_updates` variablePatrick Steinhardt, Sep 12, 2024
  88. 18/21 environment: stop storing "core.logAllRefUpdates" globallyPatrick Steinhardt, Sep 12, 2024
  89. 19/21 environment: stop storing "core.preferSymlinkRefs" globallyPatrick Steinhardt, Sep 12, 2024
  90. 20/21 environment: stop storing "core.warnAmbiguousRefs" globallyPatrick Steinhardt, Sep 12, 2024
  91. 21/21 environment: stop storing "core.notesRef" globallyPatrick Steinhardt, Sep 12, 2024
  92. Junio C HamanoSep 12, 2024

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.