@@ -34,28 +34,19 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, commit *Commit, treePath
3434 return nil , nil , err
3535 }
3636
37- var revs map [string ]* Commit
38- if commit .repo .LastCommitCache != nil {
39- var unHitPaths []string
40- revs , unHitPaths , err = getLastCommitForPathsByCache (commit .ID .String (), treePath , entryPaths , commit .repo .LastCommitCache )
37+ revs , unHitPaths , err := commit .repo .lastCommitCache .getLastCommitForPathsByCache (commit .ID .String (), treePath , entryPaths )
38+ if err != nil {
39+ return nil , nil , err
40+ }
41+ if len (unHitPaths ) > 0 {
42+ revs2 , err := GetLastCommitForPaths (ctx , commit .repo .lastCommitCache , c , treePath , unHitPaths )
4143 if err != nil {
4244 return nil , nil , err
4345 }
44- if len (unHitPaths ) > 0 {
45- revs2 , err := GetLastCommitForPaths (ctx , commit .repo .LastCommitCache , c , treePath , unHitPaths )
46- if err != nil {
47- return nil , nil , err
48- }
4946
50- for k , v := range revs2 {
51- revs [k ] = v
52- }
47+ for k , v := range revs2 {
48+ revs [k ] = v
5349 }
54- } else {
55- revs , err = GetLastCommitForPaths (ctx , nil , c , treePath , entryPaths )
56- }
57- if err != nil {
58- return nil , nil , err
5950 }
6051
6152 commit .repo .gogitStorage .Close ()
@@ -154,7 +145,7 @@ func getFileHashes(c cgobject.CommitNode, treePath string, paths []string) (map[
154145}
155146
156147// GetLastCommitForPaths returns last commit information
157- func GetLastCommitForPaths (ctx context.Context , cache * LastCommitCache , c cgobject.CommitNode , treePath string , paths []string ) (map [string ]* Commit , error ) {
148+ func GetLastCommitForPaths (ctx context.Context , cache * lastCommitCache , c cgobject.CommitNode , treePath string , paths []string ) (map [string ]* Commit , error ) {
158149 refSha := c .ID ().String ()
159150
160151 // We do a tree traversal with nodes sorted by commit time
0 commit comments