@@ -34,28 +34,19 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, commit *Commit, treePath
34
34
return nil , nil , err
35
35
}
36
36
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 )
41
43
if err != nil {
42
44
return nil , nil , err
43
45
}
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
- }
49
46
50
- for k , v := range revs2 {
51
- revs [k ] = v
52
- }
47
+ for k , v := range revs2 {
48
+ revs [k ] = v
53
49
}
54
- } else {
55
- revs , err = GetLastCommitForPaths (ctx , nil , c , treePath , entryPaths )
56
- }
57
- if err != nil {
58
- return nil , nil , err
59
50
}
60
51
61
52
commit .repo .gogitStorage .Close ()
@@ -154,7 +145,7 @@ func getFileHashes(c cgobject.CommitNode, treePath string, paths []string) (map[
154
145
}
155
146
156
147
// 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 ) {
158
149
refSha := c .ID ().String ()
159
150
160
151
// We do a tree traversal with nodes sorted by commit time
0 commit comments