backport fix: fixed bug in GitTreeBySHA where pulling items from a page other than page 1 would fail because the wrong var was used to set the entries to return (#9482)

This commit is contained in:
Brad Albright 2019-12-24 01:01:02 -06:00 committed by zeripath
parent a276aaf61e
commit 58c38ab4b6
1 changed files with 5 additions and 5 deletions

View File

@ -79,11 +79,11 @@ func GetTreeBySHA(repo *models.Repository, sha string, page, perPage int, recurs
for e := rangeStart; e < rangeEnd; e++ { for e := rangeStart; e < rangeEnd; e++ {
i := e - rangeStart i := e - rangeStart
tree.Entries[e].Path = entries[e].Name() tree.Entries[i].Path = entries[e].Name()
tree.Entries[e].Mode = fmt.Sprintf("%06o", entries[e].Mode()) tree.Entries[i].Mode = fmt.Sprintf("%06o", entries[e].Mode())
tree.Entries[e].Type = entries[e].Type() tree.Entries[i].Type = entries[e].Type()
tree.Entries[e].Size = entries[e].Size() tree.Entries[i].Size = entries[e].Size()
tree.Entries[e].SHA = entries[e].ID.String() tree.Entries[i].SHA = entries[e].ID.String()
if entries[e].IsDir() { if entries[e].IsDir() {
copy(treeURL[copyPos:], entries[e].ID.String()) copy(treeURL[copyPos:], entries[e].ID.String())