Repository navigation
fix(@angular/build): preserve nested workspace path for git worktree cache - #34220
Conversation
…cache When an Angular workspace is located in a subdirectory of a Git repository rather than at the repository root, resolving the shared cache path in a Git worktree previously walked up to the worktree root to find the `.git` file and then resolved the cache path directly against the main repository root (`dirname(commonGitDir)`). This discarded the relative path between the worktree root and the workspace root. `getCacheBasePath` now computes the relative path from the worktree root to `workspaceRoot` and resolves the target workspace directory in the main repository. If the corresponding workspace directory exists in the main repository, the cache path is resolved relative to it; otherwise, it falls back to the worktree-local workspace root to avoid creating untracked directories in the main repository. Additionally, the directory traversal now stops at the nearest `.git` boundary. Fixes angular#34215
There was a problem hiding this comment.
Code Review
This pull request updates the cache path resolution logic for Git worktrees in nested Angular workspaces. It ensures that the cache path is resolved relative to the corresponding nested workspace in the main repository if it exists, falling back to the worktree workspace root otherwise. Additionally, unit tests have been updated to use the TEST_TMPDIR environment variable for temporary directories and new test cases have been added to verify this behavior. I have no further feedback to provide as there are no review comments.
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When an Angular workspace is located in a subdirectory of a Git repository rather than at the repository root, resolving the shared cache path in a Git worktree previously walked up to the worktree root to find the
.gitfile and then resolved the cache path directly against the main repository root (dirname(commonGitDir)). This discarded the relative path between the worktree root and the workspace root.getCacheBasePathnow computes the relative path from the worktree root toworkspaceRootand resolves the target workspace directory in the main repository. If the corresponding workspace directory exists in the main repository, the cache path is resolved relative to it; otherwise, it falls back to the worktree-local workspace root to avoid creating untracked directories in the main repository. Additionally, the directory traversal now stops at the nearest.gitboundary.Fixes #34215