#65

Strip trailing .git from shorthand and bare repo specs

OpenSteel-techwants to merge intofrom

Problem

parse_repo_spec strips a trailing .git only for full-URL inputs. The shorthand, host-prefixed, and bare forms keep .git as part of the repo name, which then flows into the host API request:

opensrc github:owner/repo.git → GET https://api.github.com/repos/owner/repo.git → 404 → "Repository "owner/repo.git" not found on GitHub."

So opensrc reports a repo as missing when it actually exists. is_repo_spec accepts owner/repo.git (the .git matches the repo-name regex), so the input is routed to the repo path and then silently fails. It shows up whenever a .git-suffixed clone URL is shortened by hand or copied from a package's repository shorthand.

Inputrepo beforerepo after
https://github.com/owner/repo.gitrepo ✅repo
github:owner/repo.gitrepo.git ❌repo
github.com/owner/repo.gitrepo.git ❌repo
owner/repo.gitrepo.git ❌repo

Fix

Strip a single trailing .git in the shared spec-parsing tail so all input forms match the full-URL branch. GitHub/GitLab/Bitbucket all forbid repo names ending in .git, so the strip is always safe.

Tests

Added unit tests for the shorthand, bare, host-prefixed, and @ref forms, plus a regression guard for the full-URL form. cargo test, cargo fmt --check, and cargo clippy -- -D warnings all pass.

Activity

2
vercel[bot]4mo ago

@Steel-tech is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.