diff --git a/git/errors.go b/git/errors.go index b5d5e0674..51a6ddb05 100644 --- a/git/errors.go +++ b/git/errors.go @@ -1,6 +1,10 @@ package git -import "errors" +import ( + "errors" + + "github.com/gogs/git-module" +) var ( // ErrFileNotFound is returned when a file is not found. @@ -9,4 +13,6 @@ var ( ErrDirectoryNotFound = errors.New("directory not found") // ErrReferenceNotFound is returned when a reference is not found. ErrReferenceNotFound = errors.New("reference not found") + // ErrRevisionNotExist is returned when a revision is not found. + ErrRevisionNotExist = git.ErrRevisionNotExist ) diff --git a/git/repo.go b/git/repo.go index 6eb0e07e3..f2b1d058a 100644 --- a/git/repo.go +++ b/git/repo.go @@ -103,8 +103,9 @@ func (r *Repository) Tree(ref *Reference) (*Tree, error) { return nil, err } return &Tree{ - Tree: tree, - Path: "", + Tree: tree, + Path: "", + Repository: r, }, nil } diff --git a/git/tree.go b/git/tree.go index c69e3391a..1828b9cb2 100644 --- a/git/tree.go +++ b/git/tree.go @@ -14,7 +14,8 @@ import ( // Tree is a wrapper around git.Tree with helper methods. type Tree struct { *git.Tree - Path string + Path string + Repository *Repository } // TreeEntry is a wrapper around git.TreeEntry with helper methods. @@ -86,8 +87,9 @@ func (t *Tree) SubTree(path string) (*Tree, error) { return nil, err } return &Tree{ - Tree: tree, - Path: path, + Tree: tree, + Path: path, + Repository: t.Repository, }, nil }