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

Backport #40022 by @silverwind

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.

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Giteabotandsilverwind authored and GitHub committed 2026-10-26 19:43:11 +01:00
1 parent dbe80ac05c
commit 1b8a7c4d85
3 files changed
+3

No files matched your search

+1
View File
@@ -811,6 +811,7 @@ LEVEL = Info
;[git.config]
;diff.algorithm = histogram
;core.logAllRefUpdates = true
;maintenance.strategy = gc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+1
View File
@@ -89,6 +89,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
secGitReflog := rootCfg.Section("git.reflog")
if secGitReflog.HasKey("ENABLED") {
+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]