Repository navigation
Conversation
On a partial clone, `git remote -v` prints the filter after the direction, as in `origin <url> (fetch) [blob:none]`. Every remote parser anchored right after `(fetch)`/`(push)` and dropped that line, so repository identity came back empty, `listRemotes` omitted the remote, `ensureRemote` added a duplicate, and GitHub repository resolution and Forgejo host matching skipped it. All five sites now share one parser in `@t3tools/shared/git` that accepts trailing bracketed annotations after the direction. Unannotated output parses exactly as before. Fixes pingdotgg#12764 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This focused bug fix centralizes Git remote parsing and restores partial-clone remote recognition across the affected identity and source-control paths. The behavioral change is narrow, preserves ordinary output handling, and has direct parser and consumer regression coverage. You can add or adjust custom eligibility rules. Learn more. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #15172, which was closed because it did not name the model and harness used. This is a fresh rebuild on current
mainby the model and harness listed at the end, reviewed by two others.What Changed
Git prints the partial-clone filter after the fetch direction on promisor remotes:
Five parsers anchored their regex right after
(fetch)/(push)and dropped that line. They now share one parser in@t3tools/shared/git(next tonormalizeGitRemoteUrl), which accepts Git's optional trailing[…]annotations and keeps the name, URL and direction captures as they were. Lines without an annotation parse exactly as before.The sites: repository identity (
RepositoryIdentityResolver), source-control provider detection (GitVcsDriver.listRemotes), reusing an existing remote (GitVcsDriverCore.ensureRemote), GitHub repository resolution (also used by the PR-checkout remote lookup), and Forgejo host matching. Since #15172, GitHub and Forgejo moved into their own packages, so the parser now lives inpackages/shared, which all of them already depend on.Why
Fixes #12764. On a partial clone the fetch remote vanished from every one of those paths, so:
ensureRemoteadded a second remote instead of reusingorigin, GitHub base-repository resolution could skiporigin, and Forgejo fell back to https for an http remote.Julius's triage asked for one suffix-tolerant helper shared by all parsers, with synthetic-stdout tests rather than tests that depend on the installed Git printing the annotation. #7499 (open) covers the identity resolver only.
Verification
To reproduce:
git clone --filter=blob:none <any repo>, add it as a project, and open the Pull Requests view.vp test run …in each package), all passing:packages/sharedgit.test.ts36 (new parser tests: plain lines,[blob:none],[tree:0], two annotations, CRLF and blank lines, malformed lines, the fetch-URL helper);apps/serverRepositoryIdentityResolver,GitVcsDriver,GitVcsDriverCore213;source-control-githubresolution and provider tests 46;source-control-forgejoprovider tests 22. One new consumer test per site goes through its public entry point.mainand the new tests kept, each site test fails:expected undefined to be 'github.com/pingdotgg/t3code',expected [] to deeply equal [ { name: 'origin', … } ],expected 'pingdotgg' to equal 'origin',expected { host: 'github.com', locator: null } to deeply equal …, andexpected 'https://forgejo.local:3000' to equal 'http://forgejo.local:3000'.t3,@t3tools/shared,@t3tools/source-control-github,@t3tools/source-control-forgejo): exit 0.vp lintandvp fmt --checkon the changed files: clean apart from two existing warnings on untouched lines.In-app evidence from #15172 (macOS, Git 2.50.1, a partial clone of this repository as the only project on a fresh server state; same behaviour as this rebuild, not re-captured):
Before:
After:
Not checked: a live Azure DevOps or Forgejo remote (synthetic tests only), and Windows or Linux test runs. Known and unchanged: a remote URL containing a space is still dropped, as before; with one parser now, that would be a one-place follow-up.
Models
servertogiton review.