slachiewicz opened a new pull request, #1297:
URL: https://github.com/apache/maven-site-plugin/pull/1297

   Fixes #1159. Same approach as #227, rebased onto current master, which #227 
no longer merges cleanly against — credit to @kwin for the diagnosis and for 
the unwrap-then-compare shape.
   
   `getTopLevelProject` compares `distributionManagement.site.url` through 
`URIPathDescriptor.sameSite()`, which needs a hierarchical URI. An SCM URL such 
as `scm:git:https://github.com/org/repo.git` is opaque, so scheme, host and 
port parse as `scm`, `null` and `-1`: every SCM URL matches every other, and a 
project inherits a top-level project it shares nothing with.
   
   Two parts, and the second is easy to miss:
   
   1. Unwrap the provider-specific part through `ScmUrlUtils`, converting 
SCP-like `git@host:path` to `ssh://host/path` and normalising svn `https` to 
`http`, so the two access schemes of one repository still match.
   2. Compare host **and** path. Unwrapping alone leaves two repositories on 
one forge sharing scheme, host and port, so `sameSite()` still calls them one 
site. The child path must lie under the parent path, whole segments only, so 
`/foo` does not contain `/foobar`.
   
   A URL that neither unwrapping nor URI parsing resolves counts as a separate 
site, which leaves a project deploying its own site rather than merging it into 
an unrelated one.
   
   Six unit tests, including the sibling-repository case that fails with 
unwrapping alone.
   
   Verified: with 3.22.1-SNAPSHOT, plexus-xml — a single-module project whose 
site URL is an SCM URL — stages into `target/staging` with 216 files, where 
3.22.0 staged into `target/staging/../plexus-xml.git` with none. That is the 
downstream report in codehaus-plexus/plexus-pom#333.
   
   *This change was created with AI assistance.*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to