Skip to content

fix: preserve worktree path bytes in porcelain parsing - #190

Merged
andyrewlee merged 2 commits into
mainfrom
advisor/012-preserve-worktree-path-bytes
Sep 27, 2026
Merged

andyrewlee merged 2 commits into
mainfrom
advisor/012-preserve-worktree-path-bytes

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

Summary

  • Plan 012: worktree enumeration prefers worktree list --porcelain -z so paths containing newlines/tabs/spaces round-trip exactly; legacy line output is strictly validated with a guarded fallback.

Stacked on advisor/011-test-installer-signature-decisions. Part of the advisor/NNN plan series; merge in stack order.

Test plan

  • Repository CI gate (make ci) passed on this commit or an identical code tree (docs/design-only branches ran their validators + focused suites instead)
  • Reviewer: land bottom-up; GitHub retargets the next PR when this one merges

@andyrewlee
andyrewlee force-pushed the advisor/011-test-installer-signature-decisions branch from 5eb7828 to f86b456 Compare September 26, 2026 12:11
@andyrewlee
andyrewlee force-pushed the advisor/012-preserve-worktree-path-bytes branch from 1e470a4 to 449656c Compare September 26, 2026 12:11
@andyrewlee
andyrewlee force-pushed the advisor/011-test-installer-signature-decisions branch from f86b456 to a7743dd Compare September 27, 2026 02:10
@andyrewlee
andyrewlee changed the base branch from advisor/011-test-installer-signature-decisions to main September 27, 2026 02:22
git worktree list --porcelain is line-framed, so a path containing a
newline split into a truncated path plus forged worktree/HEAD records —
corrupting the ownership map callers trust for navigation and removal.

Use the NUL-terminated -z grammar (git >= 2.36) so path bytes survive
losslessly, validate structural fields, and propagate parse errors. On a
git that does not know -z, keep the line-based listing only after the
worktrees/*/gitdir registrations prove no path carries CR/LF bytes;
ambiguous repositories fail with an actionable error instead of a
forged record set.
@andyrewlee
andyrewlee force-pushed the advisor/012-preserve-worktree-path-bytes branch from 449656c to 5a8687e Compare September 27, 2026 02:22
Same constraint as the command-recording shim: Windows cannot exec an
extensionless sh file, so the -z fallback tests silently never
intercepted git (the shim log was never written and the real binary
answered every call). Write git.cmd on Windows - os/exec runs it via
cmd - parameterize the injected failure as message + exit code, and
assert on normalized log lines.
@andyrewlee
andyrewlee merged commit e602760 into main Sep 27, 2026
4 checks passed
@andyrewlee
andyrewlee deleted the advisor/012-preserve-worktree-path-bytes branch September 27, 2026 02:42
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