Skip to content

fix(server): a Git project's status and commits leave out the repositories inside it - #6

Open
na0s-fleet-agents[bot] wants to merge 1 commit into
mainfrom
fix/nested-repo-git-views
Open

na0s-fleet-agents[bot] wants to merge 1 commit into
mainfrom
fix/nested-repo-git-views

Conversation

@na0s-fleet-agents

Copy link
Copy Markdown

Problem

When a project's own folder is a Git repository and holds other repositories (which pingdotgg#35925 now counts as part of the project), the root repository's live Git views still include them. git status lists each one as an untracked folder (? api/), the Uncommitted and Changes diffs and the branch change totals count it, and Commit runs git add -A, which stages it as an embedded gitlink ("adding embedded git repository"). Each of those repositories already has its own diff and Git actions, so they show up twice, and committing the root writes broken gitlinks into it.

To reproduce: make a repository shop with a commit, clone or git init two repositories with commits at shop/api and shop/web, edit a file in shop, add shop as a project and open a thread. The commit dialog lists api/ and web/ next to the real change, and committing records both as gitlinks.

Change

The root's Git views now leave out the repositories the project covers inside it, the same way checkpoints already do (nestedScopePaths / excludedPathspecs in CheckpointService.ts and GitVcsDriver.ts).

  • WorkspaceFolders.nestedRepositories returns those repositories for a checkout: the project's folders (discoverFolders plus trackedFolders) when the cwd is the project folder, or the task folder's worktrees when the cwd is a thread's copy of it. It keeps only folders inside the checkout and drops submodules, like nestedScopePaths.
  • GitVcsDriverCore reads them through a VcsNestedRepositories context reference (empty by default, like VcsAutomaticFetchInterval, so tests and other builds keep plain Git behavior) and adds :(top,exclude,literal) pathspecs to status --porcelain=2, the status diff-index --numstat, the branch change totals, the working-tree and branch-range review diff, and the commit-all git add -A.
  • A repository the root's .gitignore lists is dropped from the pathspecs after git check-ignore --no-index, as the checkpoint capture does: git add fails on a pathspec naming an ignored folder.
  • server.ts provides the reference before the first GitVcsDriver build.
  • One sentence in docs/user/multi-repo-projects.md says the project folder's own repository leaves the inner ones out.

Single-file diffs, the Commits source, and repositories a project does not cover (for example ones t3.json ignoreRepositories lists) are unchanged.

Scope

This is a small fix of an obvious bug in pingdotgg#35925's behavior: that change made repositories inside a project folder part of the project and already keeps them out of the root's checkpoints, but the root's live status, diff, and commit still include them. It needs no issue because the defect is a direct inconsistency with what pingdotgg#35925 does for checkpoints, and the fix only applies the same exclusion to the live views. No schema or UI copy changes.

Verification

  • GitVcsDriverCore.test.ts › "leaves the repositories a project covers out of its checkout's Git views" (real Git): a root repository with nested api and web repositories, web also in the root .gitignore, and one root change. It checks status files, branch totals, the Uncommitted review files and patch, and that commit-all commits only the root change and leaves the tree clean. It fails on main's driver (status lists api/). With only the review or only the commit exclusion removed, the review or commit assertion fails.
  • WorkspaceFolders.test.ts: two existing cases extended. One checks that a project folder resolves its discovered repositories (docs, src/web) and that a repository's own folder resolves none. The other checks that a task folder's copy of the project folder resolves its nested worktree (vendor/lib) when Git names the checkout by its resolved path.
  • vp run check:changed origin/main: format, lint, knip, typecheck and tests pass (383 tests in 3 files).
  • vp run scenarios:prove with a scenario (not committed) that seeds a shop repository with nested api and web repositories and one change to notes.md: the scenario fails on base 1368854828 ("expected 2 to be 0" nested rows in the commit dialog) and passes on head.

Commit dialog, before and after:

Before: the commit dialog lists api/ and web/ next to notes.md
After: the commit dialog lists only notes.md

Diff pane, Uncommitted, and the thread details Git panel, before and after:

Before: Uncommitted lists api and web as new files, totals +4
After: Uncommitted lists only notes.md, totals +2

Not checked:

  • The task-folder case end to end in the app. It is covered by the resolver test and by the driver test, but the scenario only covers a local thread.
  • Desktop and mobile clients. The fix is server-side and they read the same status and diff RPCs, but I did not run them.
  • Windows path handling for the resolver (the tests ran on Linux).
  • Performance on a project folder with many top-level folders: each status read of a project folder now runs the same disk scan discoverFolders does for checkpoints. I did not measure it.

Made with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

…ories inside it

When a project's own folder is a Git repository, the repositories the project
covers inside it (pingdotgg#35925) showed up in the root repository's live Git views:
status listed each as an untracked folder, the Uncommitted and Changes diffs and
branch totals counted it, and Commit staged it as an embedded gitlink.

The root's status, numstat, branch totals, working-tree review diff and
commit-all now exclude those repositories, as checkpoints already do. The list
comes from the project's folders (or the task folder's worktrees), and ones the
root's .gitignore lists are dropped from the pathspec so git add does not fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant