issue-287: forgejo: detect ssh:// remotes #288
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!288
Loading…
Reference in a new issue
No description provided.
Delete branch "bug/issue-287/forgejo-detect-ssh-remotes"
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?
parseRemoteUrlin theforgejoextension only matchedhttp(s)://URLs and the SCP-stylegit@host:owner/repoform.ssh://-style remotes — a very common way of configuringorigin, e.g.ssh://git@host/owner/repo.git, orssh://git@host:2222/owner/repowith an explicit port — matched neither branch and produced:…which made every tool relying on auto-detection fail (
forgejo_detect, issues, PRs, Actions).What changed
http://,https://,ssh://,git://) are now parsed with the WHATWGURLparser, which also discards embeddeduser:token@credentials (replacing the manual strip).apiScheme()/apiHost()helpers derive the API host: http/https keep their own scheme and port (e.g.http://localhost:3000), while ssh/git remotes map tohttps://with the transport port dropped — the:2222in anssh://URL is the SSH port, not the API port.git@host:owner/repo(its host character class is now[^:/]+).tscbuilds clean. A live probe of 7 remote forms confirms the new behaviour.Per-file breakdown
extensions/forgejo/src/git.ts— replaced the two regex branches (http(s) match +git@match with manual token strip) inparseRemoteUrlwith the URL-first parse, theapiScheme/apiHosthelpers, and the SCP fallback; updated the doc comment to list the supported forms.extensions/forgejo/tests/git.test.ts— renamed the existing SCP test to disambiguate; added 3parseRemoteUrltests:ssh://full-URL form, transport-port dropped from the API host, and embedded-token stripped from anssh://URL.Closes #287