Skip to content

fix(prdiff): "viewed" renamed files are not collapsed - #100

Merged
justinmk merged 1 commit into
justinmk:mainfrom
ggsalas:fix/viewed-renamed-files
Nov 15, 2026
Merged

justinmk merged 1 commit into
justinmk:mainfrom
ggsalas:fix/viewed-renamed-files

Conversation

@ggsalas

@ggsalas ggsalas commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Problem:
Marking a renamed file as "Viewed" (cv) has no visible effect: the prdiff never collapses it to a (viewed) <path> line, because prepare_pr_diff looks up the old path instead of the new one.

Solution:
Use diff_git_pat (the new path), the same pattern find_file_heading already uses.

Added a test that fails without the fix. make test passes.

I found this while reviewing a PR with renamed files and tested the fix locally; I used Claude Code to help track down the cause and write the patch.

Problem:
Marking a renamed file as "Viewed" (cv) has no visible effect: the file
is never collapsed to a "(viewed) <path>" line. `prepare_pr_diff` keys
the lookup off the `a/<old-path>` of the `diff --git a/… b/…` header,
but `viewed` is keyed by the new path (as GitHub reports it, and as
`find_file_heading` sends it to `markFileAsViewed`).

Solution:
Use `diff_git_pat` (captures the `b/<new-path>`), the same pattern used
by `find_file_heading`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@justinmk
justinmk merged commit bb67084 into justinmk:main Nov 15, 2026
1 check passed
@justinmk

Copy link
Copy Markdown
Owner

Thanks

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.

2 participants