fix(git): return no submodule web link when the URL cannot be parsed (#39274)

This commit is contained in:
KBS authored and GitHub committed 2026-10-04 13:40:27 +00:00
1 parent 6809ecf2d2
commit 9bb8751b29
2 files changed
+9 -2

No files matched your search

@@ -37,4 +37,11 @@ func TestCommitSubmoduleLink(t *testing.T) {
assert.Equal(t, "/subpath/user/repo", wl.RepoWebLink)
assert.Equal(t, "/subpath/user/repo/compare/1111...2222", wl.CommitWebLink)
})
t.Run("UnparsableURL", func(t *testing.T) {
// both calls share one instance on purpose: the second one used to see the cached parse result
sf := NewCommitSubmoduleFile("/any/repo-link", "full-path", "git@github.com:", "aaaa")
assert.Nil(t, sf.SubmoduleWebLinkTree(t.Context()))
assert.Nil(t, sf.SubmoduleWebLinkCompare(t.Context(), "1111", "2222"))
})
}