diff mbox series

[v2,10/10] repository.h: drop unused `gc_cruft_packs`

Message ID c67ee7c2ff9456eda1c5468cf68ddb1b83d37c85.1681850424.git.me@ttaylorr.com (mailing list archive)
State Accepted
Commit 029a632c35861b3395c71e767d80bbf463dc1ae1
Headers show
Series gc: enable cruft packs by default | expand

Commit Message

Taylor Blau April 18, 2023, 8:41 p.m. UTC
As of the previous commit, all callers that need to read the value of
`gc.cruftPacks` do so outside without using the `repo_settings` struct,
making its `gc_cruft_packs` unused. Drop it accordingly.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 repo-settings.c | 4 +---
 repository.h    | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Junio C Hamano April 19, 2023, 10:19 p.m. UTC | #1
Taylor Blau <me@ttaylorr.com> writes:

> As of the previous commit, all callers that need to read the value of
> `gc.cruftPacks` do so outside without using the `repo_settings` struct,
> making its `gc_cruft_packs` unused. Drop it accordingly.
>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> ---
>  repo-settings.c | 4 +---
>  repository.h    | 1 -
>  2 files changed, 1 insertion(+), 4 deletions(-)

This is in line with the current design of repo-settings, and it is
a total tangent to this topic, but in retrospect, if we structured
how "what's experimental" is determined in a more distributed way,
we didn't have to have this patch.  That is, instead of saying "ok
we are in a repository with experimental setting turned on, and the
set of features to be enabled are centrally described in this
settings structure", each opt-in features (like the code that reads
"gc.cruftPacks" by calling git_config_get_bool() to override its
default value) can select their default/fallback values by seeing if
the experimental bit is set.

In any case, this patch looks good and we have one fewer such
centrally managed bit.
diff mbox series

Patch

diff --git a/repo-settings.c b/repo-settings.c
index 0a6c0b381f..a8d0b98794 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -41,10 +41,8 @@  void prepare_repo_settings(struct repository *r)
 	repo_cfg_bool(r, "feature.experimental", &experimental, 0);
 
 	/* Defaults modified by feature.* */
-	if (experimental) {
+	if (experimental)
 		r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
-		r->settings.gc_cruft_packs = 1;
-	}
 	if (manyfiles) {
 		r->settings.index_version = 4;
 		r->settings.index_skip_hash = 1;
diff --git a/repository.h b/repository.h
index 15a8afc5fb..50eb0ce391 100644
--- a/repository.h
+++ b/repository.h
@@ -33,7 +33,6 @@  struct repo_settings {
 	int commit_graph_generation_version;
 	int commit_graph_read_changed_paths;
 	int gc_write_commit_graph;
-	int gc_cruft_packs;
 	int fetch_write_commit_graph;
 	int command_requires_full_index;
 	int sparse_index;