diff options
Diffstat (limited to 'commit.go')
-rw-r--r-- | commit.go | 11 |
1 files changed, 1 insertions, 10 deletions
@@ -3,7 +3,6 @@ package git import ( "bufio" "bytes" - "errors" "fmt" "io" "sort" @@ -11,9 +10,6 @@ import ( "gopkg.in/src-d/go-git.v2/core" ) -// New errors defined by this package. -var ErrFileNotFound = errors.New("file not found") - type Hash core.Hash // Commit points to a single tree, marking it as what the project looked like @@ -59,12 +55,7 @@ func (c *Commit) NumParents() int { // nil error if the file exists. If the file does not exists, it returns // a nil file and the ErrFileNotFound error. func (c *Commit) File(path string) (file *File, err error) { - for file := range c.Tree().Files() { - if file.Name == path { - return file, nil - } - } - return nil, ErrFileNotFound + return c.Tree().File(path) } // Decode transform an core.Object into a Blob struct |