Repository navigation
fix(server): bare repositories now group with projects of the same remote - #17340
Open
shrikantkalar023 wants to merge 1 commit into
Open
shrikantkalar023 wants to merge 1 commit into
shrikantkalar023 wants to merge 1 commit into
Conversation
…mote `git rev-parse --show-toplevel` exits 128 in a bare repository, so bare-repo projects resolved no repository identity and never grouped with same-remote projects in other environments. When it fails, probe `--is-bare-repository --absolute-git-dir` and key bare repositories by their git dir. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a localized server bug fix that extends repository identity resolution to bare repositories while preserving existing worktree behavior. The added tests cover the new layouts and failure paths, and no schema, deployment, configuration, or static-analysis behavior is changed. 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.
Problem
Projects that share a git remote show as one project-picker entry across environments. A bare repository registered as a project (a
git clone --baredir, or the.bare+.gitfile layout) never joins that entry: each environment's copy shows separately.RepositoryIdentityResolverfinds the repository root withgit rev-parse --show-toplevel. In a bare repository that exits 128 (fatal: this operation must be run in a work tree), so the project gets no repository identity and the client falls back to its per-environment path key.Change
When
--show-toplevelexits non-zero, the resolver runs one probe,git rev-parse --is-bare-repository --absolute-git-dir, and uses the git dir as the root only when git reportstrue. Remote lookup is unchanged;git remote -vworks in a bare git dir..gitfolder reportsfalseand still gets no identity.rootPathis the git dir for a bare repository; the contract comment onrootPathsays so. No schema, client, or DB change.GitVcsDriver.detectRepositoryrequires a work tree). That is unchanged.Scope and approval
No prior issue. I think this fits the small, focused bug-fix exception: projects are grouped by remote, bare repositories have remotes, and the resolver drops them only because it asks git for a work-tree-only value. The change touches root discovery, its tests, and the contract comment for
rootPath.Related:
.bare) layouts. This PR does not change which folders can be added or how they are initialized.Verification
vp test run apps/server/src/project/RepositoryIdentityResolver.test.ts apps/server/src/project/ProjectEnrichmentService.test.ts: 25/25 pass. New tests:.bare+.gitfile layout (resolved from the container and from.bare) get the samecanonicalKeyas a checkout of the same repo with an SSH remote.rootPathis the git dir..gitfolder resolves tonull.null.--show-toplevelresolves tonullwithout the probe.expected null not to be null. Removing the"true"check fails the.gitfolder test; removing the timeout check fails the timeout test.buildProjectGroupsfrompackages/client-runtime, with the bare project in one environment and the checkout in another.env-laptop:<path>.github.com/t3tools/t3code.repositoryandrepository_pathmodes, for a plain bare repo, a.barecontainer, and.bareitself.vp lintandvp fmt --checkon the changed files;vp run --filter t3 typecheckandvp run --filter @t3tools/contracts typecheckpass.--show-toplevelexits 0 with empty output in a bare repo, so the result staysnullas before; a live two-machine client session.Claude Opus 5.5 via Claude Code in T3 Code; verification by GPT-6.1-Sol via Codex.