diff options
author | Nick <nick.guenther@polymtl.ca> | 2023-02-14 16:23:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-14 21:23:04 +0000 |
commit | 618c9118c1652fdeea2a2ae0d1459bb1fd3d5169 (patch) | |
tree | 9513df4c5584aafe42578a0c16dcf9b7d6a0c500 | |
parent | 71ee48809835120c50bb37048b2fe06e2c779da4 (diff) | |
download | gitea-618c9118c1652fdeea2a2ae0d1459bb1fd3d5169.tar.gz gitea-618c9118c1652fdeea2a2ae0d1459bb1fd3d5169.zip |
Remember to attach the parent tree when converting TreeEntry() -> Tree() (#22902)
!fixup https://github.com/go-gitea/gitea/pull/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 README-related 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 FollowLinks()
hit the nil ptree. This makes the ptree non-nil and thus repairs it.
-rw-r--r-- | modules/git/tree_entry.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/git/tree_entry.go b/modules/git/tree_entry.go index c4085c0278..9513121487 100644 --- a/modules/git/tree_entry.go +++ b/modules/git/tree_entry.go @@ -101,12 +101,13 @@ func (te *TreeEntry) FollowLinks() (*TreeEntry, error) { return entry, nil } -// returns the subtree, or nil if this is not a tree +// returns the Tree pointed to by this TreeEntry, or nil if this is not a tree func (te *TreeEntry) Tree() *Tree { t, err := te.ptree.repo.getTree(te.ID) if err != nil { return nil } + t.ptree = te.ptree return t } |