Skip to content

Commit 961c7d9

Browse files
committed
Fix lising submodules.
Signed-off-by: Filip Navara <[email protected]>
1 parent f653c6b commit 961c7d9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

modules/git/commit_info.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,19 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string, cache LastCom
3333
commitsInfo := make([][]interface{}, len(tes))
3434
for i, entry := range tes {
3535
if rev, ok := revs[entry.Name()]; ok {
36-
commit := convertCommit(rev)
37-
commitsInfo[i] = []interface{}{entry, commit}
36+
entryCommit := convertCommit(rev)
37+
if entry.IsSubModule() {
38+
subModuleURL := ""
39+
if subModule, err := commit.GetSubModule(entry.Name()); err != nil {
40+
return nil, nil, err
41+
} else if subModule != nil {
42+
subModuleURL = subModule.URL
43+
}
44+
subModuleFile := NewSubModuleFile(entryCommit, subModuleURL, entry.ID.String())
45+
commitsInfo[i] = []interface{}{entry, subModuleFile}
46+
} else {
47+
commitsInfo[i] = []interface{}{entry, entryCommit}
48+
}
3849
} else {
3950
commitsInfo[i] = []interface{}{entry, nil}
4051
}

0 commit comments

Comments
 (0)