Skip to content

fix: parse GitLab subgroup paths on unknown hosts - #342

Closed
dyk1454683243-sudo wants to merge 1 commit into
npm:mainfrom
dyk1454683243-sudo:cursor/gitlab-subgroup-paths-3f0e
Closed

dyk1454683243-sudo wants to merge 1 commit into
npm:mainfrom
dyk1454683243-sudo:cursor/gitlab-subgroup-paths-3f0e

Conversation

@dyk1454683243-sudo

Copy link
Copy Markdown

Fixes #54.

GitLab subgroup remotes (GROUP/SUBGROUP/REPO) on gitlab.com already parsed, but the issue's self-hosted SCP form did not:

git@git.DOMAIN.com:GROUP/SUBGROUP/REPO.git

fromUrl returned undefined and fromManifest fell through to unknownHostedUrl, which could not parse SCP-style URLs and returned null.

Changes

  • Treat unrecognized git remotes with a nested namespace (GROUP/SUBGROUP/.../REPO) as GitLab-like, keeping the original hostname so generated SSH/HTTPS/browse/tarball URLs stay on the self-hosted domain.
  • HTTPS/git+https fallbacks require a .git suffix to avoid matching arbitrary website paths.
  • Two-segment remotes on unknown hosts stay unknown (GitHub Enterprise / generic user/repo is still out of scope; see Support non-public hosts such as GitHub Enterprise #39).
  • unknownHostedUrl now uses parseUrl, so two-segment SCP repository fields still produce a usable HTTPS URL.
  • addHost() defaults to nested-path extraction so similar custom hosts parse subgroups without a hand-written extract.

Tests

Regression coverage in test/gitlab-subgroups.js for:

  • git@gitlab.com:GROUP/SUBGROUP/REPO.git and HTTPS/git+https/git+ssh equivalents
  • the issue This package cannot handle Gitlab subgroups #54 self-hosted SCP URL and fromManifest
  • deeper nesting (a/b/c/d.git)
  • addHost custom domains
  • two-segment unknown remotes remaining undefined

npm test passes (35 tests, lint clean).

Treat GROUP/SUBGROUP/REPO remotes on unrecognized git hosts as
GitLab-like so fromUrl/fromManifest no longer fall back to
unknownHostInfo. Custom hosts registered with addHost also get
nested-path extraction by default.

Fixes npm#54

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@dyk1454683243-sudo

Copy link
Copy Markdown
Author

Withdrawing this PR while I clean up a high-volume open-PR backlog. Sorry for the noise — happy to come back later with a focused change if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

This package cannot handle Gitlab subgroups

2 participants