fix: normalize rename-only diff paths#194
Conversation
Greptile SummaryThis PR fixes a rendering bug where Confidence Score: 5/5Safe to merge — targeted bug fix with no logic regressions and good test coverage at both integration and unit levels. All findings are P2 or lower. Normalization is applied at the right layers (source in the loader, defensively in UI helpers and the OpenTUI adapter). The early-return optimization in No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["@pierre/diffs parsePatchFiles()\nreturns prevName with \\n"] --> B["loaders.ts buildDiffFile()\nnormalizeDiffMetadataPaths()"]
B --> C["DiffFile.path / previousPath\n(clean, no trailing newlines)"]
C --> D["files.ts UI helpers\nsidebarFileName / fileLabelParts\n(defensive normalizeDiffPath)"]
C --> E["App renders correct\nold/path -> new/path header"]
F["HunkDiffView.tsx (OpenTUI)\nExternal diff input"] --> G["toInternalDiffFile()\nnormalizeDiffMetadataPaths()\nnormalizeDiffPath()"]
G --> C
H["findPatchChunk()\npath matching"] --> I["normalizeDiffPath on candidates\nbefore chunk lookup"]
Reviews (1): Last reviewed commit: "fix: normalize rename-only diff paths" | Re-trigger Greptile |
Summary
Problem
@pierre/diffscan returnprevNamewith a trailing newline for pure rename patches. That made Hunk render rename-only headers inconsistently, including cases where the old path and-> new/pathappeared on separate lines instead of oneold/path -> new/pathheader.Testing
bun run typecheckbun testbun run test:tty-smokeThis PR description was generated by Pi using OpenAI GPT-5