aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/tree_test.go
diff options
context:
space:
mode:
authorJames Ravn <james@r-vn.org>2018-07-05 10:50:09 +0100
committerJames Ravn <james@r-vn.org>2018-07-10 10:05:04 +0100
commitb304997a387a5106321fe87069a6f136d9fbd1f6 (patch)
tree2bc5aba417803c5c887ce9c21701c94eba74e920 /plumbing/object/tree_test.go
parentfcfd239c49baee9195f7b8234f46288a29c3951c (diff)
downloadgo-git-b304997a387a5106321fe87069a6f136d9fbd1f6.tar.gz
plumbing: object, expose ErrEntryNotFound in FindEntry. Fixes #883
FindEntry will return ErrDirNotFound if the directory doesn't exist. But it doesn't return a public error if the entry itself is missing. This exposes the internal error ErrEntryNotFound, so users can programmatically check for this condition. Signed-off-by: James Ravn <james@r-vn.org>
Diffstat (limited to 'plumbing/object/tree_test.go')
-rw-r--r--plumbing/object/tree_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/plumbing/object/tree_test.go b/plumbing/object/tree_test.go
index 3a687dd..59d5d21 100644
--- a/plumbing/object/tree_test.go
+++ b/plumbing/object/tree_test.go
@@ -114,6 +114,12 @@ func (s *TreeSuite) TestFindEntry(c *C) {
c.Assert(e.Name, Equals, "foo.go")
}
+func (s *TreeSuite) TestFindEntryNotFound(c *C) {
+ e, err := s.Tree.FindEntry("not-found")
+ c.Assert(e, IsNil)
+ c.Assert(err, Equals, ErrEntryNotFound)
+}
+
// Overrides returned plumbing.EncodedObject for given hash.
// Otherwise, delegates to actual storer to get real object
type fakeStorer struct {