Skip to content

Preserve repository-root path whitespace - #59

Merged
hzw0813 merged 5 commits into
mainfrom
fix/repository-root-whitespace
Aug 15, 2026
Merged

Preserve repository-root path whitespace#59
hzw0813 merged 5 commits into
mainfrom
fix/repository-root-whitespace

Conversation

@hzw0813

@hzw0813 hzw0813 commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • stop applying JavaScript String.trim() to git rev-parse --show-toplevel output
  • remove only Git's final line terminator, preserving valid trailing repository-root whitespace on POSIX filesystems
  • add a regression with sibling directories repository and repository so the old implementation demonstrably resolves to the wrong path
  • regenerate tracked dist and document the fix

Why

findRepository() currently runs Git from the correct candidate repository and then calls result.stdout.trim() before resolving the reported top-level path. A repository directory may legally end in whitespace on POSIX. If repository and sibling repository both exist, trimming the Git output silently changes path identity and can make ProofDiff return the sibling directory instead of the repository Git actually identified.

The fix strips only the output record's final newline (CRLF on Windows, LF elsewhere) and leaves all path characters untouched.

Verification

  • full npm test passed after the change
  • clean npm run clean && npm run build passed
  • git diff --check passed
  • generated dist/git.* refreshed
  • temporary updater workflow/script removed from the final diff

@hzw0813
hzw0813 merged commit 662000a into main Aug 15, 2026
13 checks passed
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