The local diff loader strips valid trailing whitespace from the repository root. It either errors or silently reads a different checkout when the trimmed path exists.
Reproductions
Missing trimmed sibling: Create a Git checkout whose directory is named project (one trailing space), commit a baseline, and edit a tracked file. Git review status succeeds, but load_local_diff returns No such file or directory (os error 2).
Existing trimmed sibling: Create two separate checkouts named project and project. Commit base.txt in both, then give the file distinct edits in each. Load the Working diff for project .
An isolated Rust harness using the unchanged production module produced:
requested checkout: .../project [trailing space]
displayed repo: .../project
displayed addition: unrelated checkout edit
The assertion comparing snapshot.repo_root to the canonical requested checkout failed. The two paths differed by the trailing space after canonicalization.
Cause and impact
discover_repository uses:
PathBuf::from(String::from_utf8_lossy(&root_output.stdout).trim())
This removes filename whitespace, not just Git's output terminator. Subsequent diff commands run from the altered path.
GitRepository::discover uses a lossless output-line decoder and correctly resolves the intended checkout. The inspector's mutation dispatch discovers that repository from the actual session cwd. Thus displayed diffs and file actions can refer to different checkouts. The wrong-checkout display was reproduced; destructive UI actions were not exercised.
Expected behavior
Decode the root path losslessly and remove only the output record terminator. Reuse the existing Git review path-decoding behavior where appropriate.
Cover a trailing-space checkout both with and without an existing trimmed sibling, and assert that displayed root, contents, and mutation target agree.
Validated against main 1196d89 using temporary repositories and production Rust modules. No product files were modified.
The local diff loader strips valid trailing whitespace from the repository root. It either errors or silently reads a different checkout when the trimmed path exists.
Reproductions
Missing trimmed sibling: Create a Git checkout whose directory is named
project(one trailing space), commit a baseline, and edit a tracked file. Git review status succeeds, butload_local_diffreturnsNo such file or directory (os error 2).Existing trimmed sibling: Create two separate checkouts named
projectandproject. Commitbase.txtin both, then give the file distinct edits in each. Load the Working diff forproject.An isolated Rust harness using the unchanged production module produced:
The assertion comparing
snapshot.repo_rootto the canonical requested checkout failed. The two paths differed by the trailing space after canonicalization.Cause and impact
discover_repository uses:
This removes filename whitespace, not just Git's output terminator. Subsequent diff commands run from the altered path.
GitRepository::discover uses a lossless output-line decoder and correctly resolves the intended checkout. The inspector's mutation dispatch discovers that repository from the actual session cwd. Thus displayed diffs and file actions can refer to different checkouts. The wrong-checkout display was reproduced; destructive UI actions were not exercised.
Expected behavior
Decode the root path losslessly and remove only the output record terminator. Reuse the existing Git review path-decoding behavior where appropriate.
Cover a trailing-space checkout both with and without an existing trimmed sibling, and assert that displayed root, contents, and mutation target agree.
Validated against main
1196d89using temporary repositories and production Rust modules. No product files were modified.