src-d / go-git

Project has been moved to: https://github.com/go-git/go-git
https://github.com/go-git/go-git
Apache License 2.0
4.91k stars 542 forks source link

Read repo status #1275

Closed towoe closed 4 years ago

towoe commented 4 years ago

I am trying to get the status of a repository, but the following code will not return. But I am not sure if this even the correct approach, so I wanted to check if the following snippet is valid? (For readability I removed the error checking.)

repo, _ := git.PlainOpen("/path/to/repo")
work, _ := repo.Worktree()
st, _ := work.Status() // will not return

The last code I was able to see while debugging was https://github.com/src-d/go-git/blob/1a7db85bca7027d90afdb5ce711622aaac9feaed/worktree_status.go#L227

So it could be that the Storer has to be initialized first? Would be glad for feedback. Thanks.

towoe commented 4 years ago

Closing this as I am currently not able to reproduce the issue. The problem was only apparent for one out of multiple repositories.