-
Notifications
You must be signed in to change notification settings - Fork 809
Closed
Description
Steps to reproduce:
- Setup git config file to contain a feature requiring
index.version = 4
, e.g.
[feature]
manyFiles = true
- Checkout a branch, call
git status
which creates index according to settings - Using
gitGo
create repository using the path above:
repo, _ := goGit.PlainOpen(repoPath)
- Get a worktree status:
worktree, _ := repo.Worktree()
worktreeStatus, err := worktree.Status()
err
is plumbing.format.index.ErrInvalidChecksum
My clue is that the index file has version 4
encoded in its header as of documentation https://git-scm.com/docs/gitformat-index
Where the library hardcodes version 2 and uses it for decoding index:
from: storage.filesystem.index.decoder.go
func (s *IndexStorage) Index() (i *index.Index, err error) {
idx := &index.Index{
Version: 2,
}
f, err := s.dir.Index()
if err != nil {
if os.IsNotExist(err) {
return idx, nil
}
return nil, err
}
defer ioutil.CheckClose(f, &err)
d := index.NewDecoder(f)
err = d.Decode(idx)
return idx, err
}
Metadata
Metadata
Assignees
Labels
No labels