aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/tree.go
diff options
context:
space:
mode:
authorniukuo <niukuo@gmail.com>2019-03-27 23:32:01 +0800
committerniukuo <niukuo@gmail.com>2019-03-27 23:32:01 +0800
commit579399e38a80422e47cd21023ee60259be975bf3 (patch)
tree52ae988e4a33c3b031a719ef80f6fc8889831bf6 /plumbing/object/tree.go
parentdef8f2530687eb024fc9a3f4ccbb33a422cdd16f (diff)
downloadgo-git-579399e38a80422e47cd21023ee60259be975bf3.tar.gz
fix panic in object.Tree.FindEntry
Signed-off-by: niukuo <niukuo@gmail.com>
Diffstat (limited to 'plumbing/object/tree.go')
-rw-r--r--plumbing/object/tree.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go
index 78d61a1..1f9ea26 100644
--- a/plumbing/object/tree.go
+++ b/plumbing/object/tree.go
@@ -135,7 +135,7 @@ func (t *Tree) FindEntry(path string) (*TreeEntry, error) {
pathCurrent := ""
// search for the longest path in the tree path cache
- for i := len(pathParts); i > 1; i-- {
+ for i := len(pathParts) - 1; i > 1; i-- {
path := filepath.Join(pathParts[:i]...)
tree, ok := t.t[path]