fix tree/content routes not using reference param
1 file changed, 7 insertions(+), 2 deletions(-)
changed files
M git/tree.go → git/tree.go
@@ -4,12 +4,17 @@ import ( "fmt" "strings" + "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" ) -func (g *Repo) FileTree(path string) ([]NiceTree, error) { +func (g *Repo) FileTree(path string, ref string) ([]NiceTree, error) { + hash, err := g.r.ResolveRevision(plumbing.Revision(ref)) + if err != nil { + return nil, fmt.Errorf("resolving rev %s for %s: %w", ref, path, err) + } path = strings.TrimSuffix(path, "/") - c, err := g.r.CommitObject(g.h) + c, err := g.r.CommitObject(*hash) if err != nil { return nil, fmt.Errorf("commit object: %w", err) }