@@ -119,6 +119,22 @@ describe('parseRepoUrl', () => {
119119 const result = parseRepoUrl ( 'https://github.com/' )
120120 expect ( result ) . toEqual ( { host : 'github' , owner : null , name : null } )
121121 } )
122+
123+ // The canonical OpenDaylight link keeps repo identity in ?p=, not the (fixed)
124+ // pathname — a generic parts[0]/parts[1] split would collapse every OpenDaylight
125+ // repo to the same owner='gerrit', name='gitweb'.
126+ it ( 'derives owner=null and name from the ?p= query for OpenDaylight Gerrit links' , ( ) => {
127+ expect ( parseRepoUrl ( 'https://git.opendaylight.org/gerrit/gitweb?p=netconf.git' ) ) . toEqual ( {
128+ host : 'gerrit' ,
129+ owner : null ,
130+ name : 'netconf' ,
131+ } )
132+ expect ( parseRepoUrl ( 'https://git.opendaylight.org/gerrit/gitweb?p=aaa.git' ) ) . toEqual ( {
133+ host : 'gerrit' ,
134+ owner : null ,
135+ name : 'aaa' ,
136+ } )
137+ } )
122138} )
123139
124140describe ( 'normalizeScmUrl' , ( ) => {
@@ -206,6 +222,17 @@ describe('normalizeScmUrl', () => {
206222 expect ( normalizeScmUrl ( 'https://svn.apache.org/repos/asf' ) ) . toBeNull ( )
207223 } )
208224
225+ // java.net requires an explicit SVN marker because the bare host is shared with
226+ // non-SVN content (forums, wikis, JIRA) — this must not accidentally widen to
227+ // treat every java.net URL as SVN.
228+ it ( 'treats java.net as SVN only with an explicit scm:svn:/svn:// marker' , ( ) => {
229+ expect ( normalizeScmUrl ( 'https://java.net/projects/foo/sources/svn' ) ) . toBeNull ( )
230+ expect ( normalizeScmUrl ( 'scm:svn:https://java.net/svn/foo/trunk' ) ) . toBe (
231+ 'https://java.net/svn/foo' ,
232+ )
233+ expect ( normalizeScmUrl ( 'svn://java.net/svn/foo/trunk' ) ) . toBe ( 'https://java.net/svn/foo' )
234+ } )
235+
209236 it ( 'does not map dead services that incidentally match an "svn" text filter' , ( ) => {
210237 expect ( normalizeScmUrl ( 'http://specs.googlecode.com/svn/trunk' ) ) . toBeNull ( )
211238 } )
@@ -408,6 +435,21 @@ describe('normalizeScmUrl', () => {
408435 expect ( normalizeScmUrl ( 'https://android.googlesource.com/' ) ) . toBeNull ( )
409436 } )
410437
438+ // cs.android.com is the Android Code Search UI, backed by the same Gitiles
439+ // repos as android.googlesource.com — same identity passthrough applies.
440+ it ( 'passes through cs.android.com urls unchanged, mirroring the googlesource identity form' , ( ) => {
441+ expect ( normalizeScmUrl ( 'https://cs.android.com/androidx/platform/frameworks/support' ) ) . toBe (
442+ 'https://cs.android.com/androidx/platform/frameworks/support' ,
443+ )
444+ } )
445+
446+ it ( 'returns null for a bare OpenDaylight Gerrit root with no repo path' , ( ) => {
447+ // /gerrit/ alone (as opposed to /gerrit/gitweb?p=...) has nothing to extract —
448+ // same "no derivable identity" case as the bare gerrit.onosproject.org root
449+ // tested above, confirmed against real declared_repository_url values.
450+ expect ( normalizeScmUrl ( 'https://git.opendaylight.org/gerrit/' ) ) . toBeNull ( )
451+ } )
452+
411453 it ( 'recovers GitHub Pages project-page urls (owner.github.io/repo)' , ( ) => {
412454 expect ( normalizeScmUrl ( 'https://silentbalanceyh.github.io/vertx-zero/' ) ) . toBe (
413455 'https://github.com/silentbalanceyh/vertx-zero' ,
@@ -594,9 +636,7 @@ describe('normalizeScmUrl', () => {
594636
595637 it ( 'returns null for non-SCM OpenDaylight URLs instead of mistaking them for a repo' , ( ) => {
596638 // A `p` query on some unrelated path is not a gitweb browse link.
597- expect (
598- normalizeScmUrl ( 'https://git.opendaylight.org/somewhere?p=netconf.git' ) ,
599- ) . toBeNull ( )
639+ expect ( normalizeScmUrl ( 'https://git.opendaylight.org/somewhere?p=netconf.git' ) ) . toBeNull ( )
600640 // Single path segment with no .git suffix — e.g. a static asset, not a clone URL.
601641 expect ( normalizeScmUrl ( 'https://git.opendaylight.org/favicon.ico' ) ) . toBeNull ( )
602642 } )
0 commit comments