Import: https source URLs ending in .git should be handled, not error #398
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#398
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's wrong
Importing a repo from an
https://source URL that ends in.gitfails with an error, instead of being handled. The user pasteshttps://git.example.com/owner/repo.git(the standard git clone URL — what every forge displays in its clone box) and the import refuses, while the same URL without the suffix works.Where the
.githandling exists today (code evidence)internal/repoimport/url.go—NormalizeSource:isGitHubShorthand/splitShorthandtrim.git(:147, :169), andcanonicalGitHubURLexplicitly doesstrings.TrimSuffix(p, ".git")(:205, :211-214)..git…:443/uppercase/trailing-slash/.git/variants of one logical source" normalize to one canonical form..git-suffixed form: the URL is carried essentially verbatim into the clone step, and the failure the user sees comes back from the import instead of being normalized away.POST /api/v1/repos/mirrors) rides the sameNormalizeSource, so mirror imports from.gitURLs fail the same way.What's needed
.giton the last path segment is stripped for canonicalization (so…/repo.git→…/repo), while a trailing slash form (…/repo/,…/repo.git/) is handled per the #237 normalization contract (those variants were already called out there — this ticket extends the same canonicalization to the bare.gitsuffix if it's not already effective on the generic path).NormalizeSourcedirectly withhttps://<forge>/owner/repo.git,…/repo,…/repo.git/,…/repo/and assert one canonical form for all four;.git-suffixed URL actually clones and lands, not just that the normalizer returns a pretty string — the clone step consumes the canonical URL, so a normalization that doesn't survive to the clone args would pass the unit test and still fail the import.canonical:hint,Import.jsx); confirm the hint shows the stripped form so the user sees the suffix was understood.Acceptance criteria
https://<forge>/owner/repo.gitsucceeds identically to the same URL without the suffix (same canonical source, same provenance, same idempotent re-import/no-op behavior).NormalizeSourceunit tests cover the four variant forms above and assert a single canonical URL; the GitHub-path behavior is unchanged..gitURL clones and lands (not just normalization)..gitvariants.Closed: this was filed inline in violation of the Issue Writer contract (tickets go to subagents). Re-filing via subagent as # shortly - no content is lost, the same body is being refiled with the investigation evidence intact.