Skip to content

fix: Handle SSH over HTTPS GitHub remote URLs#2049

Merged
charlesvien merged 12 commits intomainfrom
05-05-handle_ssh_over_https_github_remote_urls
May 7, 2026
Merged

fix: Handle SSH over HTTPS GitHub remote URLs#2049
charlesvien merged 12 commits intomainfrom
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

charlesvien commented May 6, 2026

@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
Base automatically changed from 05-05-onboarding_nits to main May 7, 2026 02:45
@charlesvien charlesvien force-pushed the 05-05-handle_ssh_over_https_github_remote_urls branch from 131321a to 07b789b Compare May 7, 2026 04:54
@charlesvien charlesvien merged commit ed295c4 into main May 7, 2026
16 checks passed
@charlesvien charlesvien deleted the 05-05-handle_ssh_over_https_github_remote_urls branch May 7, 2026 06:27
@charlesvien charlesvien added the Create release This will trigger a new release label May 7, 2026 — with Graphite App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Create release This will trigger a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants