Repository navigation
Conversation
On a partial clone, `git remote -v` appends the filter to the fetch line, as in `origin <url> (fetch) [blob:none]`. The remote parsers anchored right after `(fetch)`, so they dropped that line: repository identity came back empty (no linked PRs, one repo split into two projects), `listRemotes` omitted the remote, `ensureRemote` added a duplicate, and GitHub base-repository and Forgejo host matching skipped it. All five parse sites now share one parser that accepts trailing bracketed annotations after the direction. Unannotated output parses exactly as before. Fixes pingdotgg#12764
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused server bug fix that centralizes Notes:
You can add or adjust custom eligibility rules. Learn more. |
Dismissing prior approval to re-evaluate 63c5313
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughA shared parser now reads ChangesPartial-clone remote handling
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Partial-clone remotes should now be recognized for repository identity, provider detection, and remote reuse. No merge-blocking risk was identified. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change recognizes valid partial-clone remote listings while preserving destination URLs, repository-selection checks, and existing remote-creation behavior. No material security risk was found in the reviewed change. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What Changed
Git prints the partial-clone filter after the fetch direction on promisor remotes:
Five server parsers anchored their regex right after
(fetch)/(push)and dropped that line. They now share one parser,parseGitRemoteVerboseinapps/server/src/git/remoteRefs.ts(with aparseRemoteFetchUrlswrapper for the two fetch-only callers), that 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:
RepositoryIdentityResolver(repository identity),GitVcsDriver.listRemotes(source-control provider detection),GitVcsDriverCore.ensureRemote(reusing an existing remote),GitHubCli.selectGitHubBaseRepository(which repoghreads), and the Forgejo remote lookup.Why
Fixes #12764. On a partial clone the fetch remote vanished from every one of those paths, so:
Source control provider unknown … pull request sync skipped;ensureRemoteadded a second remote instead of reusingorigin, andghbase-repository selection could skiporiginfor a fork 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; #12776 and #14913 covered three and four of the sites and were closed in the V2 transition and by their author respectively. This covers all five on current
main.Verification
To reproduce:
git clone --filter=blob:none <any repo>, add it as a project, and open the Pull Requests view (or group the sidebar by repository with a normal clone of the same repo on another environment).git clone --filter=blob:none) added as the only project to a fresh server state, once with a server built frommainand once from this branch. Onmainthe Pull Requests view is empty for it, because the project never gets a repository identity. With this branch the same view lists the repository's open pull requests. (Each run started from an empty state so the identity was resolved by the code under test, not reused from an earlier run.)Before:
After:
vp test run …fromapps/server):src/git/remoteRefs.test.ts(new, synthetic output: plain lines,[blob:none],[tree:0], two annotations, CRLF, blank and malformed lines), plus one consumer test per site:RepositoryIdentityResolver.test.ts,GitVcsDriver.test.ts(listRemotes),GitVcsDriverCore.test.ts(ensureRemote),GitHubCli.test.ts(selectGitHubBaseRepository), and the Forgejo lookup inSourceControlDiscovery.test.ts. The six files: 231 passed.mainand the new tests kept, the five consumer tests fail (expected undefined to be 'github.com/pingdotgg/t3code',expected [] to deeply equal [ { name: 'origin', … } ],expected 'pingdotgg' to equal 'origin',expected null to deeply equal { owner: 'pingdotgg', name: 't3code' }, and the Forgejo host falling back to https).vp run --filter t3 typecheck,vp lintandvp fmt --checkon the changed files: clean.Not checked: a live Azure DevOps or Forgejo remote; those paths are covered by the synthetic tests only. Windows and Linux runs of the test files are not done yet.