Skip to content

follow-up: /sweep's repo-detection fallback regex also rejects ssh:// GitHub remotes #2363

Closed

Description

@carlos-alm

Problem

Greptile flagged (Confidence 4/5, on PR #2362, which mirrored /sweep's already-merged PR #2185 fix into /resolve) that the two-pass sed fallback:

```bash
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null
|| git remote get-url origin 2>/dev/null
| sed -nE 's#^(git@github.com:|https://github\.com/)([^/]+/[^/]+)/?$#\2#p'
| sed -E 's/.git$//')
```

only accepts git@github.com:owner/repo (scp-style SSH) and https://github.com/owner/repo — it silently rejects ssh://git@github.com/owner/repo, a valid, real-world GitHub remote URL form. The OLD (buggy, .git-suffix-retaining) regex this replaced happened to accept it too, since its permissive .*github\.com[:/] prefix matched regardless of URL scheme — so this is a genuine regression for anyone whose origin uses the ssh:// URI form, not just an already-existing gap.

Since /sweep's PR #2185 is the ORIGINAL source of this exact fallback pattern (later mirrored into /resolve by #2186/PR #2362, where the ssh:// gap was caught and fixed before merge), /sweep itself still has the unfixed version.

Fix direction

Add ssh://git@github\.com/ as a third alternative in the anchored prefix group, exactly as fixed in /resolve (PR #2362):

```bash
sed -nE 's#^(git@github.com:|https://github\.com/|ssh://git@github\.com/)([^/]+/[^/]+)/?$#\2#p'
```

Filed per this repo's scope-discipline convention — out of scope for #2186, which was specifically about porting the fix to /resolve, not re-touching /sweep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions