Bug Description
When a repository's .git/config enables index.skipHash indirectly via Git's
feature.manyFiles = true (or feature.experimental = true) meta-setting,
go-git fails to read the index with:
index decoder: invalid checksum
Git writes the index trailer as 20 (or 32 for SHA-256) zero bytes when
index.skipHash is in effect. go-git supports index.skipHash when the key is
present literally under [index], but it does not expand Git's
feature.* aliases, so Config.Index.SkipHash stays unset and the decoder
verifies the checksum against the all-zero trailer and rejects the index.
go-git Version
v6.0.0-alpha
Steps to Reproduce
git init repo && cd repo
git config feature.manyFiles true # implies index.skipHash=true in Git >= 2.40
echo hi > a.txt && git add a.txt && git commit -m init
package main
import (
"fmt"
git "github.com/go-git/go-git/v6"
)
func main() {
repo, err := git.PlainOpen("repo")
if err != nil {
panic(err)
}
wt, err := repo.Worktree()
if err != nil {
panic(err)
}
_, err = wt.Status()
fmt.Println("status err:", err) // => index decoder: invalid checksum
}
git status on the same repo works fine. Adding git config index.skipHash true
explicitly also makes go-git succeed, confirming the gap is alias expansion, not
checksum handling.
Additional Information
Expected behavior
go-git should honor Git's feature.manyFiles / feature.experimental
meta-settings, which expand to (per Git docs):
feature.manyFiles=true → index.skipHash=true, index.version=4, core.untrackedCache=true
feature.experimental=true → index.skipHash=true (among others)
so that reading such an index does not error. At minimum, index.skipHash
should be inferred from feature.manyFiles / feature.experimental when the
literal index.skipHash key is absent.
Notes
feature.manyFiles is increasingly common: some Git GUIs/tooling and large
monorepos enable it for performance.
- A repo with this config also typically carries
UNTR (untracked cache) and
FSMN (fsmonitor) index extensions; those decode fine as optional extensions —
the only failure is the zero-checksum verification.
- Possibly related: Bug: worktree cannot be read if created with version 4 #1123 (index version 4 read failure).
Bug Description
When a repository's
.git/configenablesindex.skipHashindirectly via Git'sfeature.manyFiles = true(orfeature.experimental = true) meta-setting,go-git fails to read the index with:
Git writes the index trailer as 20 (or 32 for SHA-256) zero bytes when
index.skipHashis in effect. go-git supportsindex.skipHashwhen the key ispresent literally under
[index], but it does not expand Git'sfeature.*aliases, soConfig.Index.SkipHashstays unset and the decoderverifies the checksum against the all-zero trailer and rejects the index.
go-git Version
v6.0.0-alpha
Steps to Reproduce
git statuson the same repo works fine. Addinggit config index.skipHash trueexplicitly also makes go-git succeed, confirming the gap is alias expansion, not
checksum handling.
Additional Information
Expected behavior
go-git should honor Git's
feature.manyFiles/feature.experimentalmeta-settings, which expand to (per Git docs):
feature.manyFiles=true→index.skipHash=true,index.version=4,core.untrackedCache=truefeature.experimental=true→index.skipHash=true(among others)so that reading such an index does not error. At minimum,
index.skipHashshould be inferred from
feature.manyFiles/feature.experimentalwhen theliteral
index.skipHashkey is absent.Notes
feature.manyFilesis increasingly common: some Git GUIs/tooling and largemonorepos enable it for performance.
UNTR(untracked cache) andFSMN(fsmonitor) index extensions; those decode fine as optional extensions —the only failure is the zero-checksum verification.