Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Commit 592891f

Browse files
committed
Fixed a bug where TreeEntries were getting cached, (thanks @filipnavara)
1 parent c811eb4 commit 592891f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tree.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ type Tree struct {
1818

1919
entries Entries
2020
entriesParsed bool
21+
22+
entriesRecursive Entries
23+
entriesRecursiveParsed bool
2124
}
2225

2326
// NewTree create a new tree according the repository and commit id
@@ -73,14 +76,14 @@ func (t *Tree) ListEntries() (Entries, error) {
7376

7477
// ListEntriesRecursive returns all entries of current tree recursively including all subtrees
7578
func (t *Tree) ListEntriesRecursive() (Entries, error) {
76-
if t.entriesParsed {
77-
return t.entries, nil
79+
if t.entriesRecursiveParsed {
80+
return t.entriesRecursive, nil
7881
}
7982
stdout, err := NewCommand("ls-tree", "-t", "-r", t.ID.String()).RunInDirBytes(t.repo.Path)
8083

8184
if err != nil {
8285
return nil, err
8386
}
84-
t.entries, err = parseTreeEntries(stdout, t)
85-
return t.entries, err
87+
t.entriesRecursive, err = parseTreeEntries(stdout, t)
88+
return t.entriesRecursive, err
8689
}

0 commit comments

Comments
 (0)