Use ListEntries

This commit is contained in:
william-allspice 2024-08-23 15:05:07 -05:00
parent da917b7288
commit ac40e5a0bf

View File

@ -8,6 +8,8 @@ import (
"io"
"sort"
"strings"
"code.gitea.io/gitea/modules/log"
)
// Type returns the type of the entry (commit, tree, blob)
@ -190,7 +192,12 @@ func (te *TreeEntry) GetPathInRepo() string {
current := te.ptree
for current != nil && current.ptree != nil {
for _, entry := range current.ptree.entries {
entries, err := current.ptree.ListEntries()
if err != nil {
log.Error("Failed to climb git tree %v", err)
return ""
}
for _, entry := range entries {
if entry.ID == current.ID {
path = entry.Name() + "/" + path
break