Skip to content

feat(@angular/build): share persistent build cache across git worktrees#33519

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:feat-cache-share-git-worktrees
Open

feat(@angular/build): share persistent build cache across git worktrees#33519
clydin wants to merge 1 commit into
angular:mainfrom
clydin:feat-cache-share-git-worktrees

Conversation

@clydin

@clydin clydin commented Jul 6, 2026

Copy link
Copy Markdown
Member

This change automatically resolves the default persistent cache directory relative to the common git directory (the main repository root) instead of the worktree root when a Git worktree is detected. This prevents cache duplication across multiple checkouts/worktrees of the same repository.

Closes #33321

This change automatically resolves the default persistent cache directory relative to the common git directory (the main repository root) instead of the worktree root when a Git worktree is detected. This prevents cache duplication across multiple checkouts/worktrees of the same repository.

Closes angular#33321
@clydin clydin added the target: minor This PR is targeted for the next minor release label Jul 6, 2026
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/build labels Jul 6, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for resolving the Angular cache path relative to the main repository root when working within a Git worktree. It introduces a helper function getCacheBasePath in both the build and CLI utilities to traverse directories, parse .git files, and locate the common Git directory if a worktree is detected. Comprehensive unit tests are also added. The review feedback points out that wrapping the entire directory traversal loop in a try...catch block could prematurely abort the search on file system errors (such as permission issues). It is recommended to scope the try...catch block to individual file system operations inside the loop to ensure robust traversal.

Comment thread packages/angular/build/src/utils/normalize-cache.ts
Comment thread packages/angular/cli/src/commands/cache/utilities.ts
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 6, 2026
@clydin clydin requested a review from alan-agius4 July 6, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build detected: feature PR contains a feature commit target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share persistent build cache across git worktrees

1 participant