@@ -551,6 +551,28 @@ function normalizeApacheGitwebUrl(host: string, pathname: string, search: string
551551 return `https://${ host } /repos/asf/${ name } `
552552}
553553
554+ /**
555+ * Eclipse's cgit instance serves repos as /c/<owner>/<repo>[.git][/tree/...], the
556+ * same owner/repo shape as the generic hosts but under a fixed /c/ prefix that
557+ * cgit requires for a working link (unlike GitHub-style hosts, a bare
558+ * https://git.eclipse.org/<owner>/<repo> does not resolve) — so the prefix is
559+ * kept in the output rather than stripped like the generic path logic would.
560+ */
561+ const ECLIPSE_CGIT_HOSTS = new Set ( [ 'git.eclipse.org' ] )
562+
563+ function normalizeEclipseCgitUrl ( host : string , pathname : string ) : string | null {
564+ if ( ! pathname . startsWith ( '/c/' ) ) return null
565+
566+ const segments = pathname . slice ( '/c/' . length ) . split ( '/' ) . filter ( Boolean )
567+ if ( segments . length < 2 ) return null
568+
569+ const owner = segments [ 0 ]
570+ const name = segments [ 1 ] . replace ( / \. g i t $ / , '' )
571+ if ( ! owner || ! name || / \$ \{ | % 7 B / i. test ( owner ) || / \$ \{ | % 7 B / i. test ( name ) ) return null
572+
573+ return `https://${ host } /c/${ owner } /${ name } `
574+ }
575+
554576/**
555577 * Converts the raw SCM URL from a POM (declared_repository_url) into a clean,
556578 * canonical `https://<host>/<owner>/<repo>` repository URL suitable for storage
@@ -621,6 +643,10 @@ export function normalizeScmUrl(raw: string | null): string | null {
621643 return normalizeApacheGitwebUrl ( host , parsed . pathname , parsed . search )
622644 }
623645
646+ if ( ECLIPSE_CGIT_HOSTS . has ( host ) ) {
647+ return normalizeEclipseCgitUrl ( host , parsed . pathname )
648+ }
649+
624650 if ( ! SCM_HOSTS . has ( host ) ) return null
625651
626652 // Require at least owner + repo path segments
0 commit comments