fix(git): default to the gc maintenance strategy (#40022)

Git 2.54 made "geometric" the default auto-maintenance strategy. Pushes
wait for its foreground reflog expiry
(https://github.com/go-gitea/gitea/issues/39693), and its detached
repacks race with filesystem operations, as in
https://github.com/go-gitea/gitea/actions/runs/40236681252/job/121299686933.
Pin the pre-2.54 "gc" strategy, older git ignores it.

https://github.com/go-gitea/gitea/pull/39745 is the more complete fix
which disables the auto-maintenance.
This commit is contained in:
silverwind authored and GitHub committed 2026-10-26 14:05:34 +00:00
1 parent 85211296dd
commit 8321b09912
3 files changed
+3

No files matched your search

+1
View File
@@ -810,6 +810,7 @@ LEVEL = Info
;[git.config]
;diff.algorithm = histogram
;core.logAllRefUpdates = true
;maintenance.strategy = gc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+1
View File
@@ -87,6 +87,7 @@ func loadGitFrom(rootCfg ConfigProvider) {
GitConfig.Options = make(map[string]string)
GitConfig.SetOption("diff.algorithm", "histogram")
GitConfig.SetOption("core.logAllRefUpdates", "true")
GitConfig.SetOption("maintenance.strategy", "gc") // git 2.54's push-time default "geometric" delays pushes and repacks concurrently with other writes
for _, key := range secGitConfig.Keys() {
GitConfig.SetOption(key.Name(), key.String())
+1
View File
@@ -27,6 +27,7 @@ a.b = 1
loadGitFrom(cfg)
assert.Equal(t, "1", GitConfig.Options["a.b"])
assert.Equal(t, "histogram", GitConfig.Options["diff.algorithm"])
assert.Equal(t, "gc", GitConfig.Options["maintenance.strategy"])
cfg, err = NewConfigProviderFromData(`
[git.config]