Skip to content

Support URLs in forge pr checkout#104

Merged
andrew merged 5 commits into
git-pkgs:mainfrom
untitaker:pr-checkout-url
May 26, 2026
Merged

Support URLs in forge pr checkout#104
andrew merged 5 commits into
git-pkgs:mainfrom
untitaker:pr-checkout-url

Conversation

@untitaker

@untitaker untitaker commented May 25, 2026

Copy link
Copy Markdown
Contributor

Fix #102

forge has some helper functions that parse repo/owner from a URL, all within detect.go and forge.go. For example splitOwnerRepo just handles all URLs with zero levels of abstraction.

But I think this is the right architecture instead: Parse domain out of URL, and dispatch to the respective forge module. The cost is quite a bit of code duplication, but the logic can be tested separately.

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this covers all three URL forms from #102 (url.Parse strips the fragment, and len(parts) >= 4 tolerates /pull/123/files). A few things below before merging.

On the architecture: agree that per-forge parsing is the right call given GitLab's /-/ and subgroups. The four parsePath bodies being near-copies is fine, but the 5-value return (7 from ResourceFromURL) is going to hurt the next time someone adds discussions or releases. A small ResourceRef struct would also give "pr" / "issue" somewhere to live as constants rather than magic strings repeated across four packages. Not blocking on it, but worth considering while this is fresh.

Comment thread internal/cli/pr.go Outdated
Comment thread internal/resolve/resolve.go Outdated
Comment thread internal/resolve/resolve.go Outdated
Comment thread forge.go Outdated
@andrew

andrew commented May 26, 2026

Copy link
Copy Markdown
Contributor

LGTM, thanks!

@andrew andrew merged commit 189bfd3 into git-pkgs:main May 26, 2026
4 checks passed
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.

Support for forge pr checkout URL

2 participants