1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-29 13:48:36 +00:00

Fix submodule parsing when the gitmodules is missing (#35109) (#35118)

Backport #35109

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot
2025-07-18 20:22:18 +08:00
committed by GitHub
parent 315f197790
commit 693d26914f
6 changed files with 28 additions and 9 deletions

View File

@@ -15,8 +15,12 @@ type CommitInfo struct {
func getCommitInfoSubmoduleFile(repoLink string, entry *TreeEntry, commit *Commit, treePathDir string) (*CommitSubmoduleFile, error) {
fullPath := path.Join(treePathDir, entry.Name())
submodule, err := commit.GetSubModule(fullPath)
if submodule == nil || err != nil {
if err != nil {
return nil, err
}
if submodule == nil {
// unable to find submodule from ".gitmodules" file
return NewCommitSubmoduleFile(repoLink, fullPath, "", entry.ID.String()), nil
}
return NewCommitSubmoduleFile(repoLink, fullPath, submodule.URL, entry.ID.String()), nil
}