This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 2626 ErrMaxTreeDepth = errors .New ("maximum tree depth exceeded" )
2727 ErrFileNotFound = errors .New ("file not found" )
2828 ErrDirectoryNotFound = errors .New ("directory not found" )
29+ ErrEntryNotFound = errors .New ("entry not found" )
2930)
3031
3132// Tree is basically like a directory - it references a bunch of other trees
@@ -167,16 +168,14 @@ func (t *Tree) dir(baseName string) (*Tree, error) {
167168 return tree , err
168169}
169170
170- var errEntryNotFound = errors .New ("entry not found" )
171-
172171func (t * Tree ) entry (baseName string ) (* TreeEntry , error ) {
173172 if t .m == nil {
174173 t .buildMap ()
175174 }
176175
177176 entry , ok := t .m [baseName ]
178177 if ! ok {
179- return nil , errEntryNotFound
178+ return nil , ErrEntryNotFound
180179 }
181180
182181 return entry , nil
Original file line number Diff line number Diff line change @@ -114,6 +114,12 @@ func (s *TreeSuite) TestFindEntry(c *C) {
114114 c .Assert (e .Name , Equals , "foo.go" )
115115}
116116
117+ func (s * TreeSuite ) TestFindEntryNotFound (c * C ) {
118+ e , err := s .Tree .FindEntry ("not-found" )
119+ c .Assert (e , IsNil )
120+ c .Assert (err , Equals , ErrEntryNotFound )
121+ }
122+
117123// Overrides returned plumbing.EncodedObject for given hash.
118124// Otherwise, delegates to actual storer to get real object
119125type fakeStorer struct {
You can’t perform that action at this time.
0 commit comments