@@ -16,15 +16,15 @@ import (
1616)
1717
1818// 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 ) {
2020 entryPaths := make ([]string , len (tes )+ 1 )
2121 // Get the commit for the treePath itself
2222 entryPaths [0 ] = ""
2323 for i , entry := range tes {
2424 entryPaths [i + 1 ] = entry .Name ()
2525 }
2626
27- commitNodeIndex , commitGraphFile := commit . repo .CommitNodeIndex ()
27+ commitNodeIndex , commitGraphFile := gitRepo .CommitNodeIndex ()
2828 if commitGraphFile != nil {
2929 defer commitGraphFile .Close ()
3030 }
@@ -35,14 +35,14 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
3535 }
3636
3737 var revs map [string ]* Commit
38- if commit . repo .LastCommitCache != nil {
38+ if gitRepo .LastCommitCache != nil {
3939 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 )
4141 if err != nil {
4242 return nil , nil , err
4343 }
4444 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 )
4646 if err != nil {
4747 return nil , nil , err
4848 }
@@ -58,7 +58,7 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
5858 return nil , nil , err
5959 }
6060
61- commit . repo .gogitStorage .Close ()
61+ gitRepo .gogitStorage .Close ()
6262
6363 commitsInfo := make ([]CommitInfo , len (tes ))
6464 for i , entry := range tes {
@@ -73,7 +73,7 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
7373
7474 // If the entry is a submodule, add a submodule file for this
7575 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 )
7777 if err != nil {
7878 return nil , nil , err
7979 }
@@ -84,11 +84,8 @@ func (tes Entries) GetCommitsInfo(ctx context.Context, repoLink string, commit *
8484 // get it for free during the tree traversal and it's used for listing
8585 // pages to display information about newest commit for a given path.
8686 var treeCommit * Commit
87- var ok bool
8887 if treePath == "" {
8988 treeCommit = commit
90- } else if treeCommit , ok = revs ["" ]; ok {
91- treeCommit .repo = commit .repo
9289 }
9390 return commitsInfo , treeCommit , nil
9491}
0 commit comments