Bug Description
The existing revlist.Objects is unable to handle shallow repositories, resulting in error: object not found.
go-git Version
main - very likely on latest v5 release as well
Steps to Reproduce
package main
import (
"fmt"
"os"
"github.com/go-git/go-git/v6"
. "github.com/go-git/go-git/v6/_examples"
"github.com/go-git/go-git/v6/plumbing"
"github.com/go-git/go-git/v6/plumbing/revlist"
)
func main() {
CheckArgs("<path> <ref1>")
path := os.Args[1]
ref1 := os.Args[2]
r, err := git.PlainOpen(path)
CheckIfError(err)
local, err := r.Reference(plumbing.ReferenceName(ref1), true)
CheckIfError(err)
Info("local: %s (%s)", local.Name(), local.Hash())
localHashes := []plumbing.Hash{local.Hash()}
hashes, err := revlist.Objects(r.Storer, localHashes, nil)
CheckIfError(err)
fmt.Println(len(hashes))
}
Output
$ git clone --single-branch --branch v5.12.0 --depth 1 git@github.com:go-git/go-git go-git-shallow
$ go run _examples/revlist/main.go go-git-shallow refs/tags/v5.12.0
local: refs/tags/v5.12.0 (302dddeda962e4bb3477a8e4080bc6f5a253e2bb)
error: object not found
exit status 1
Additional Information
No response
Bug Description
The existing
revlist.Objectsis unable to handle shallow repositories, resulting inerror: object not found.go-git Version
main - very likely on latest v5 release as well
Steps to Reproduce
Output
Additional Information
No response