Skip to content

fix: Handle SSH over HTTPS GitHub remote URLs#2049

Open
charlesvien wants to merge 12 commits into05-05-onboarding_nitsfrom
05-05-handle_ssh_over_https_github_remote_urls
Open

fix: Handle SSH over HTTPS GitHub remote URLs#2049
charlesvien wants to merge 12 commits into05-05-onboarding_nitsfrom
05-05-handle_ssh_over_https_github_remote_urls

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 6, 2026

Problem

GitHub URL parsing relied on hand-rolled regex that missed SSH-over-HTTPS forms and didn't handle nullable input.

Changes

  1. Parse GitHub URLs with git-url-parse instead of regex
  2. Expose path on parseGitHubUrl and reuse it for parsePrUrl
  3. Accept nullable input on both parsers and validate scheme/owner
  4. Drop the duplicate extractRepoKey helper in folders service
  5. Use parsed.path directly in git service compare and PR list calls
  6. Add edge case tests for SSH, HTTPS and PR URL variants

How did you test this?

Manually

Publish to changelog?

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title Handle SSH over HTTPS GitHub remote URLs fix: Handle SSH over HTTPS GitHub remote URLs May 6, 2026
@charlesvien charlesvien marked this pull request as ready for review May 6, 2026 06:33
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/git/src/utils.test.ts:71-85
**Identical org and repo values hide swap bugs**

Every successful-parse test case uses `"posthog"` for both `organization` and `repository`. If `segments[0]` and `segments[1]` (or `scpMatch[2]` and `scpMatch[3]`) were ever transposed, all tests would still pass. Using distinct values like `"my-org"` / `"my-repo"` in at least one test per code path would catch that class of regression. This violates the simplicity rule "expresses every idea that we need to express."

Reviews (1): Last reviewed commit: "Handle SSH over HTTPS GitHub remote URLs" | Re-trigger Greptile

Comment thread packages/git/src/utils.test.ts
Copy link
Copy Markdown
Contributor

@k11kirky k11kirky left a comment

Choose a reason for hiding this comment

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

woof, i expect there is some libs to handle this, but fine for now.

@charlesvien charlesvien force-pushed the 05-05-onboarding_nits branch from 7bbd3cb to 23df09d Compare May 6, 2026 15:43
@charlesvien charlesvien force-pushed the 05-05-handle_ssh_over_https_github_remote_urls branch from 9065fa0 to 131321a Compare May 6, 2026 15:43
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.

2 participants