mirror of
https://github.com/go-gitea/gitea
synced 2025-07-21 17:58:35 +00:00
Fix submodule parsing when the gitmodules is missing (#35109)
Follow up #35096, fix #35095, fix #35115 and add more tests The old code used some fragile behaviors which depend on the "nil" receiver. This PR should be a complete fix for more edge cases.
This commit is contained in:
@@ -129,7 +129,14 @@ func TestEntries_GetCommitsInfo(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
cisf, err := getCommitInfoSubmoduleFile("/any/repo-link", tree, commit, "")
|
||||
require.NoError(t, err)
|
||||
assert.Nil(t, cisf)
|
||||
assert.Equal(t, &CommitSubmoduleFile{
|
||||
repoLink: "/any/repo-link",
|
||||
fullPath: "file1.txt",
|
||||
refURL: "",
|
||||
refID: "e2129701f1a4d54dc44f03c93bca0a2aec7c5449",
|
||||
}, cisf)
|
||||
// since there is no refURL, it means that the submodule info doesn't exist, so it won't have a web link
|
||||
assert.Nil(t, cisf.SubmoduleWebLinkTree(t.Context()))
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user