@@ -16,15 +16,15 @@ import (
16
16
)
17
17
18
18
// GetCommitsInfo gets information of all commits that are corresponding to these entries
19
- func (tes Entries ) GetCommitsInfo (ctx context.Context , repoLink string , commit * Commit , treePath string ) ([]CommitInfo , * Commit , error ) {
19
+ func (tes Entries ) GetCommitsInfo (ctx context.Context , gitRepo * Repository , repoLink string , commit * Commit , treePath string ) ([]CommitInfo , * Commit , error ) {
20
20
entryPaths := make ([]string , len (tes )+ 1 )
21
21
// Get the commit for the treePath itself
22
22
entryPaths [0 ] = ""
23
23
for i , entry := range tes {
24
24
entryPaths [i + 1 ] = entry .Name ()
25
25
}
26
26
27
- commitNodeIndex , commitGraphFile := commit . repo .CommitNodeIndex ()
27
+ commitNodeIndex , commitGraphFile := gitRepo .CommitNodeIndex ()
28
28
if commitGraphFile != nil {
29
29
defer commitGraphFile .Close ()
30
30
}
@@ -35,14 +35,14 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
35
35
}
36
36
37
37
var revs map [string ]* Commit
38
- if commit . repo .LastCommitCache != nil {
38
+ if gitRepo .LastCommitCache != nil {
39
39
var unHitPaths []string
40
- revs , unHitPaths , err = getLastCommitForPathsByCache (commit .ID .String (), treePath , entryPaths , commit . repo .LastCommitCache )
40
+ revs , unHitPaths , err = getLastCommitForPathsByCache (commit .ID .String (), treePath , entryPaths , gitRepo .LastCommitCache )
41
41
if err != nil {
42
42
return nil , nil , err
43
43
}
44
44
if len (unHitPaths ) > 0 {
45
- revs2 , err := GetLastCommitForPaths (ctx , commit . repo .LastCommitCache , c , treePath , unHitPaths )
45
+ revs2 , err := GetLastCommitForPaths (ctx , gitRepo .LastCommitCache , c , treePath , unHitPaths )
46
46
if err != nil {
47
47
return nil , nil , err
48
48
}
@@ -58,7 +58,7 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
58
58
return nil , nil , err
59
59
}
60
60
61
- commit . repo .gogitStorage .Close ()
61
+ gitRepo .gogitStorage .Close ()
62
62
63
63
commitsInfo := make ([]CommitInfo , len (tes ))
64
64
for i , entry := range tes {
@@ -73,7 +73,7 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
73
73
74
74
// If the entry is a submodule, add a submodule file for this
75
75
if entry .IsSubModule () {
76
- commitsInfo [i ].SubmoduleFile , err = GetCommitInfoSubmoduleFile (repoLink , path .Join (treePath , entry .Name ()), commit , entry .ID )
76
+ commitsInfo [i ].SubmoduleFile , err = GetCommitInfoSubmoduleFile (gitRepo , repoLink , path .Join (treePath , entry .Name ()), commit . TreeID , entry .ID )
77
77
if err != nil {
78
78
return nil , nil , err
79
79
}
@@ -84,11 +84,8 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
84
84
// get it for free during the tree traversal and it's used for listing
85
85
// pages to display information about newest commit for a given path.
86
86
var treeCommit * Commit
87
- var ok bool
88
87
if treePath == "" {
89
88
treeCommit = commit
90
- } else if treeCommit , ok = revs ["" ]; ok {
91
- treeCommit .repo = commit .repo
92
89
}
93
90
return commitsInfo , treeCommit , nil
94
91
}
0 commit comments