Skip to content

Commit

Permalink
fix(git): add missing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Apr 7, 2022
1 parent db127f5 commit 062cb70
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 7 additions & 1 deletion git/errors.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
)
5 changes: 3 additions & 2 deletions git/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 5 additions & 3 deletions git/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 062cb70

Please sign in to comment.