Repository navigation
fix: preserve trailing newlines in registered worktree paths - #256
Conversation
|
No actionable comments were generated in the recent review. WalkthroughThe change preserves trailing newline bytes in registered worktree paths during canonicalization, decoding, resolution, sparse-source lookup, cleanup, and listing. Regression tests cover one- and two-newline paths, shortened siblings, and related command behavior. ChangesRegistered worktree paths
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Possibly related PRs
Suggested reviewers: Merge Risk:
|
Description
Preserve trailing newline bytes in registered worktree paths across target resolution, status lookup, sparse-checkout inheritance, cleanup, and listing. Keep list paths escaped through sorting and preserve command failure statuses when capturing decoded or canonical paths.
Motivation
When a registered worktree path ended in a newline and an unregistered sibling existed with that newline removed,
git gtr gocould return the unregistered sibling. The same truncation could confuse status matching, sparse-source selection, and cleanup.Type of Change
Testing
git diff --checkpassed.Manual Testing Checklist
Tested on: macOS, Bash 3.2.57, Git 2.50.1.
git gtr gostdout byte-for-byte with the registered path.Linux, Windows, and Git 2.17 were not available for runtime validation. Existing older-Git fallback tests passed; no newer Bash or Git features were introduced.
Breaking Changes
None. Detached-branch representation and remote-tracking behavior are unchanged.
Checklist
License Acknowledgment
This contribution is made under the terms of the Apache License 2.0.
Summary by CodeRabbit