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 26
26
ErrMaxTreeDepth = errors .New ("maximum tree depth exceeded" )
27
27
ErrFileNotFound = errors .New ("file not found" )
28
28
ErrDirectoryNotFound = errors .New ("directory not found" )
29
+ ErrEntryNotFound = errors .New ("entry not found" )
29
30
)
30
31
31
32
// 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) {
167
168
return tree , err
168
169
}
169
170
170
- var errEntryNotFound = errors .New ("entry not found" )
171
-
172
171
func (t * Tree ) entry (baseName string ) (* TreeEntry , error ) {
173
172
if t .m == nil {
174
173
t .buildMap ()
175
174
}
176
175
177
176
entry , ok := t .m [baseName ]
178
177
if ! ok {
179
- return nil , errEntryNotFound
178
+ return nil , ErrEntryNotFound
180
179
}
181
180
182
181
return entry , nil
Original file line number Diff line number Diff line change @@ -114,6 +114,12 @@ func (s *TreeSuite) TestFindEntry(c *C) {
114
114
c .Assert (e .Name , Equals , "foo.go" )
115
115
}
116
116
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
+
117
123
// Overrides returned plumbing.EncodedObject for given hash.
118
124
// Otherwise, delegates to actual storer to get real object
119
125
type fakeStorer struct {
You can’t perform that action at this time.
0 commit comments