Skip to content

Commit df33253

Browse files
committed
Attach the parent tree when creating Tree()
!fixup go-gitea#22177 The only place this function is used so far is in findReadmeFileInEntries(), so the only visible effect of this oversight was in an obscure corner: if the README was in a subfolder and was a symlink that pointed up, as in .github/README.md -> ../docs/old/setup.md, the README would fail to render when because FollowLinks() hit the nil ptree.
1 parent 7b5b739 commit df33253

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/git/tree_entry.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@ func (te *TreeEntry) FollowLinks() (*TreeEntry, error) {
101101
return entry, nil
102102
}
103103

104-
// returns the subtree, or nil if this is not a tree
104+
// returns the Tree pointed to by this TreeEntry, or nil if this is not a tree
105105
func (te *TreeEntry) Tree() *Tree {
106106
t, err := te.ptree.repo.getTree(te.ID)
107107
if err != nil {
108108
return nil
109109
}
110+
t.ptree = te.ptree
110111
return t
111112
}
112113

0 commit comments

Comments
 (0)