feat(@angular/build): share persistent build cache across git worktrees#33519
Conversation
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
There was a problem hiding this comment.
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.
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
@clydin will this be backported to v21? |
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