Skip to content

Split Git worktree responsibilities - #17253

Merged
nwparker merged 59 commits into
mainfrom
ra/max-lines-bottom-26-git-worktree
Aug 30, 2026
Merged

nwparker merged 59 commits into
mainfrom
ra/max-lines-bottom-26-git-worktree

Conversation

@nwparker

@nwparker nwparker commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1828 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1694 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​134

Summary

  • split the 1,693-line Git worktree module into a 28-line public facade plus focused options, parsing, path, sparse-state, listing/cache, base-refresh, add/move, and removal modules
  • preserve exact Git argv ordering, Git 2.25 capability fallbacks and host-scoped caching, WSL/native routing, timeouts, scan state, add/sparse/move/removal sequencing, branch safety, and the load-bearing SSH relay parity contract
  • reduce the max-lines baseline from 61 entries to 60; every new TypeScript module is at most 210 lines

Stacked on #17248.

Validation

  • pnpm tc
  • focused worktree suite: 22 files, 226 tests; one opt-in benchmark skipped
  • broader direct-consumer suite: 12 files, 75 tests; one integration file skipped
  • full real-binary compatibility contract on Git 2.38.1, 2.44.0, and 2.49.1: 8/8 each
  • exact Git 2.25.5 worktree-list/fallback and deferred-registration cases: 2/2
  • direct Oxlint across all 16 split modules
  • pnpm run check:code-quality:changed
  • pnpm check:max-lines-ratchet — 60 grandfathered suppressions
  • pnpm run check:runtime-electron-ratchet
  • pnpm run check:reliability-gates
  • max-lines ratchet characterization: 15 tests
  • changed-file formatting and git diff --check
  • exact 23-symbol facade export kinds, 79 moved declarations, 337 runtime literals, 114 comments, 36 Git argv expressions, singleton scan state, and 16-node/42-edge acyclic graph reconciliation
  • two independent final refactor audits: clean
  • real-commit normalized move-check: 24 adjudicated vanished lines, 157 module-boundary/import appearances

Known inherited baseline findings

Repository-wide lint reaches the pre-existing three import/no-cycle warnings in pane-terminal-output-scheduler.ts; the initial Oxlint pass also reports existing GitLab hook warnings. Repository-wide formatting reports the unchanged use-terminal-tab-cold-parking.ts. None of those files differs from the stacked base, and all changed-file gates pass.

The full Git 2.25.5 binary suite passes 7/8 locally; its unrelated stash case reads this machine's global merge.conflictStyle=zdiff3, which that Git release predates. Both worktree compatibility cases pass against the exact 2.25.5 binary.

Visual proof is N/A because this is an internal Git worktree decomposition with no intended rendered UI change.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR decomposes the Git worktree implementation into focused modules while retaining a small public facade.

  • Separates listing, parsing, path normalization, sparse-state detection, and scan caching.
  • Separates creation, base refresh, movement, removal preflight, removal, and branch cleanup.
  • Removes the worktree module from the max-lines baseline.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up scope.

No blocking failure remains.

Important Files Changed

Filename Overview
src/main/git/worktree.ts Replaces the monolithic implementation with a compact public re-export facade.
src/main/git/worktree-list-reader.ts Houses Git-version fallback, worktree parsing orchestration, path normalization, and stale-registration annotation.
src/main/git/worktree-scan-cache.ts Isolates shared in-flight worktree scans and mutation-driven generation invalidation.
src/main/git/worktree-add.ts Isolates worktree creation, base selection, local-base refresh, creation metadata, and cache invalidation.
src/main/git/worktree-removal.ts Isolates worktree removal sequencing and post-removal branch handling.
src/main/git/worktree-branch-removal.ts Isolates guarded branch deletion and preservation behavior.
src/main/git/worktree-sparse-state.ts Isolates bounded filesystem and configuration-based sparse-checkout detection.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  F[worktree.ts facade] --> L[Listing and parsing]
  F --> C[Add and sparse creation]
  F --> R[Removal and branch cleanup]
  F --> M[Move]
  L --> P[Path translation]
  L --> S[Scan cache and sparse state]
  C --> B[Base refresh]
  C --> I[Read-cache invalidation]
  R --> I
  M --> I
Loading

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

…ax-lines-bottom-10-automation-dispatch-events
…lines-bottom-20-cdp-bridge

# Conflicts:
#	src/main/browser/cdp-bridge.ts
…ax-lines-bottom-25-remote-terminal-multiplexer
…6-git-worktree

# Conflicts:
#	config/max-lines-baseline.txt
#	src/renderer/src/hooks/automation-dispatch-completion.ts
@nwparker
nwparker changed the base branch from ra/max-lines-bottom-25-remote-terminal-multiplexer to main August 30, 2026 03:20
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 13 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 600d85ae-1eac-4bb7-b893-0c65ea26acf3

📥 Commits

Reviewing files that changed from the base of the PR and between b5d0e51 and b990f76.

📒 Files selected for processing (17)
  • config/max-lines-baseline.txt
  • src/main/git/worktree-add.ts
  • src/main/git/worktree-base-refresh-analysis.ts
  • src/main/git/worktree-base-refresh.ts
  • src/main/git/worktree-branch-removal.ts
  • src/main/git/worktree-list-parser.ts
  • src/main/git/worktree-list-reader.ts
  • src/main/git/worktree-listing.ts
  • src/main/git/worktree-move.ts
  • src/main/git/worktree-operation-options.ts
  • src/main/git/worktree-path-comparison.ts
  • src/main/git/worktree-removal-preflight.ts
  • src/main/git/worktree-removal.ts
  • src/main/git/worktree-scan-cache.ts
  • src/main/git/worktree-sparse-add.ts
  • src/main/git/worktree-sparse-state.ts
  • src/main/git/worktree.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 037cc2e into main Aug 30, 2026
4 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Split speech session lifecycle

* Split terminal output scheduler pipeline

* Split mobile browser pane modules

* Prune resolved max-lines suppressions

* Split pane tree equalization logic

* Extract mobile troubleshoot screen styles

* Split external automation manager

* Split main window service attachments

* Split hosted review creation checks

* Split automation dispatch event handling

* Split settings navigation metadata

* Split daemon initialization lifecycle

* Split GitLab item dialog

* Split relay dispatcher layers

* Split mobile host screen

* Retarget mobile view settings source test

* Split runtime file client layers

* Split ports panel layers

* Split runtime environments pane layers

* Split local PTY provider responsibilities

* Split CDP bridge responsibilities

* Split relay Git handler responsibilities

* Track moved relay Git fetch audit

* Split Linear item drawer responsibilities

* Split telemetry event schema responsibilities

* Split resource usage status responsibilities

* Split remote terminal multiplexer responsibilities

* Split Git worktree responsibilities

* Fix F3-speech for stablyai#17123

* Fix F1-cycle for stablyai#17131

* Fix F4-navtest for stablyai#17157

* Fix F2-allowlist for stablyai#17161
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