aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-16 00:00:00 +0000
committerGravatar Runxi Yu2025-11-16 00:00:00 +0000
commitaa16dd0b1742ad317615d099aa6301a6c5b32974 (patch)
treea0e890b9cd330b075913310961e1d7d0a9722431
parentFix some docs and API types (diff)
signature
EntryRecursive should return ErrNotFound instead of nil, nil
-rw-r--r--obj_tree.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/obj_tree.go b/obj_tree.go
index d4246285..06d88692 100644
--- a/obj_tree.go
+++ b/obj_tree.go
@@ -148,7 +148,6 @@ func (tree *Tree) Entry(name []byte) *TreeEntry {
// EntryRecursive looks up a tree entry by path.
//
// Lookups are recursive.
-// It returns nil if no such entry exists.
func (sTree *StoredTree) EntryRecursive(repo *Repository, path [][]byte) (*TreeEntry, error) {
if len(path) == 0 {
return nil, errors.New("furgit: tree: empty path")
@@ -158,7 +157,7 @@ func (sTree *StoredTree) EntryRecursive(repo *Repository, path [][]byte) (*TreeE
for i, part := range path {
entry := currentTree.Entry(part)
if entry == nil {
- return nil, nil
+ return nil, ErrNotFound
}
if i == len(path)-1 {
return entry, nil
@@ -176,5 +175,5 @@ func (sTree *StoredTree) EntryRecursive(repo *Repository, path [][]byte) (*TreeE
currentTree = nextTree
}
- return nil, nil
+ return nil, ErrNotFound
}