fix: normalize SSH git URLs to strip browser query strings and fragments#578
fix: normalize SSH git URLs to strip browser query strings and fragments#578threebeats wants to merge 2 commits into
Conversation
SSH git URLs (git@host:path and ssh://git@host/path) were not being normalized via normalizeGitUrl, so browser-copied query strings and fragments were preserved in the cloned URL. This also fixes the path for --from passing the dirty URL downstream to git clone/shallow clone operations. Fixes profullstack#499
Greptile SummaryThis PR extends the existing
Confidence Score: 5/5Safe to merge — the change is a one-line addition that aligns the SSH branch with the already-proven HTTP normalization path. The fix is narrow and correct: normalizeGitUrl already handles SSH SCP-style and ssh:// URLs (the [?#].*$ regex is format-agnostic), repoNameFromGit independently strips query/fragment so there is no regression there, and the HTTP path has been exercising the same normalizer successfully. No edge cases in the changed logic introduce incorrect behavior. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["resolveInput(raw)"] --> B["trim input"]
B --> C{SSH URL?\ngit@ or ssh://}
C -- Yes --> D["normalizeGitUrl(input)\n[NEW: was skipped before]"]
D --> E["repoNameFromGit(input)"]
E --> F["return {kind:'git', value:normalized}"]
C -- No --> G{HTTP git URL?\n.git or forge domain}
G -- Yes --> H["normalizeGitUrl(input)"]
H --> I["repoNameFromGit(input)"]
I --> J["return {kind:'git', value:normalized}"]
G -- No --> K{https?://}
K -- Yes --> L["normalizeUrl(input)\nreturn {kind:'url'}"]
K -- No --> M["local path / doc\nreturn {kind:'path'|'doc'}"]
style D fill:#d4edda,stroke:#28a745
Reviews (2): Last reviewed commit: "docs: add SSH URL examples to normalizeG..." | Re-trigger Greptile |
Fixes #499
Browser-copied SSH git URLs like
git@github.com:org/repo?tab=readme-ov-file#usagenow have their query strings and fragments stripped vianormalizeGitUrl()before being returned fromresolveInput().Previously only HTTP git URLs went through normalization. This aligns the SSH path with the HTTP path.