Repository navigation
fix(pstack): preserve worktree paths containing spaces - #660
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
Signed-off-by: Rudy Celekli <rudycelekli@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The worktree cleanup audit splits Git's porcelain paths at whitespace. A checkout such as
feature checkoutis audited asfeature, losing its commit and dirty-state information. A spaced main checkout also points the transcript lookup at the wrong directory; spaced transcript filenames are split by xargs.Change
Strip the
worktreeprefix without splitting the rest of the path, and pass literal, NUL-delimited transcript filenames from ripgrep to stat. Regenerate the Claude Code harness from the canonical pstack source.Verification
node --test pstack/skills/poteto-mode/scripts/worktree-audit.test.mjs: 2 pass.bash -n, harness generation/check, andgit diff --checkpass.AI assistance: Codex implementation and local verification. No files are deleted by the audit or these fixtures outside their temporary directories.
Note
Low Risk
Read-only audit script parsing and test-only fixtures; no production auth or data paths.
Overview
Fixes worktree-audit so Git porcelain paths and transcript filenames with spaces are not broken by whitespace splitting.
Worktree listing now strips the
worktreeprefix withsedinstead ofawkfield splitting, for both the main worktree and the audit loop—so checkouts likefeature checkoutkeep full paths for merge/dirty/remote checks and transcript slug resolution.Transcript discovery uses ripgrep with fixed-string, NUL-delimited output (
-0 -F) andxargs -0 stat, so spaced worktree paths and spaced transcript filenames are passed through intact.Adds offline Node tests (
worktree-audit.test.mjs) that exercise paths with and without spaces, stubbinggh/origin, and on macOS assert recent-chat bucket behavior.Reviewed by Cursor Bugbot for commit 647e0f5. Bugbot is set up for automated code reviews on this repo. Configure here.