@@ -6,6 +6,7 @@ package repo
6
6
7
7
import (
8
8
"bytes"
9
+ gocontext "context"
9
10
"fmt"
10
11
"io"
11
12
"net/http"
@@ -645,22 +646,32 @@ func WikiPages(ctx *context.Context) {
645
646
return
646
647
}
647
648
648
- entries , err := commit .ListEntries ()
649
+ treePath := ""
650
+ tree , err := commit .SubTree (treePath )
651
+ if err != nil {
652
+ ctx .ServerError ("SubTree" , err )
653
+ return
654
+ }
655
+
656
+ allEntries , err := tree .ListEntries ()
649
657
if err != nil {
650
658
ctx .ServerError ("ListEntries" , err )
651
659
return
652
660
}
661
+ allEntries .CustomSort (base .NaturalSortLess )
662
+
663
+ entries , _ , err := allEntries .GetCommitsInfo (gocontext .Context (ctx ), commit , treePath )
664
+ if err != nil {
665
+ ctx .ServerError ("GetCommitsInfo" , err )
666
+ return
667
+ }
668
+
653
669
pages := make ([]PageMeta , 0 , len (entries ))
654
670
for _ , entry := range entries {
655
- if ! entry .IsRegular () {
671
+ if ! entry .Entry . IsRegular () {
656
672
continue
657
673
}
658
- c , err := wikiRepo .GetCommitByPath (entry .Name ())
659
- if err != nil {
660
- ctx .ServerError ("GetCommit" , err )
661
- return
662
- }
663
- wikiName , err := wiki_service .GitPathToWebPath (entry .Name ())
674
+ wikiName , err := wiki_service .GitPathToWebPath (entry .Entry .Name ())
664
675
if err != nil {
665
676
if repo_model .IsErrWikiInvalidFileName (err ) {
666
677
continue
@@ -672,8 +683,8 @@ func WikiPages(ctx *context.Context) {
672
683
pages = append (pages , PageMeta {
673
684
Name : displayName ,
674
685
SubURL : wiki_service .WebPathToURLPath (wikiName ),
675
- GitEntryName : entry .Name (),
676
- UpdatedUnix : timeutil .TimeStamp (c .Author .When .Unix ()),
686
+ GitEntryName : entry .Entry . Name (),
687
+ UpdatedUnix : timeutil .TimeStamp (entry . Commit .Author .When .Unix ()),
677
688
})
678
689
}
679
690
ctx .Data ["Pages" ] = pages
0 commit comments