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

[PATCH] builtin/maintenance: accept "none" as a maintenance strategy

From
DLDavid Lin <davidzylin@gmail.com>
Date
Jul 29, 2026, 19:40 UTC
Message-ID
<20260729194006.75317-1-davidlin@stripe.com>

Commit d465be2327 (builtin/maintenance: don't silently ignore invalid strategy, 2025-10-24) changed scheduled maintenance to error on an unknown maintenance strategy instead of silently defaulting to the `none` strategy.

However, `parse_maintenance_strategy()` does not recognize `none`, so Git rejects a valid and documented strategy that can be used to override an existing strategy and disable maintenance tasks.

Accept `none` as a valid maintenance strategy and add tests to ensure it's accepted.

Signed-off-by: David Lin <davidlin@stripe.com>
---
 builtin/gc.c           | 2 ++
 t/t7900-maintenance.sh | 3 +++
 2 files changed, 5 insertions(+)
diff --git a/builtin/gc.c b/builtin/gc.c
index 46999a99ab..3d1e39d46a 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -1922,6 +1922,8 @@ static const struct maintenance_strategy geometric_strategy = {
 
 static struct maintenance_strategy parse_maintenance_strategy(const char *name)
 {
+	if (!strcasecmp(name, "none"))
+		return none_strategy;
 	if (!strcasecmp(name, "incremental"))
 		return incremental_strategy;
 	if (!strcasecmp(name, "gc"))
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index a8d691719d..130c971b15 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -1022,6 +1022,9 @@ test_expect_success 'maintenance.strategy is respected' '
 		test_must_fail git -c maintenance.strategy=unknown maintenance run 2>err &&
 		test_grep "unknown maintenance strategy: .unknown." err &&
 
+		test_strategy none </dev/null &&
+		test_strategy none --schedule=weekly </dev/null &&
+
 		test_strategy incremental <<-\EOF &&
 		git pack-refs --all --prune
 		git reflog expire --all

base-commit: 13c7afec212fc97ce257d15601659314c6673d6c
-- 
2.54.0
Next: Junio C Hamano
Message 1 of 3 in “builtin/maintenance: accept "none" as a maintenance strategy”
  1. builtin/maintenance: accept "none" as a maintenance strategyDavid Lin, Jul 29, 2026
  2. Junio C HamanoJul 30, 2026
  3. Patrick SteinhardtAug 4, 2026

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.