Fix: timeline diff for a file's last checkpoint always showed no changes - #1
Open
Sil-Boydens wants to merge 2 commits into
Open
Fix: timeline diff for a file's last checkpoint always showed no changes#1Sil-Boydens wants to merge 2 commits into
Sil-Boydens wants to merge 2 commits into
Conversation
Each backup snapshot reflects the post-edit state as of that checkpoint (it's identical to the live file right after that edit), so a file's last checkpoint in a session has no "next" backup to diff against. The existing fallback compared that checkpoint's own backup to the current file, which are always identical by construction - hiding the checkpoint entirely and, if clicked anyway, showing an empty diff. Fix: for a checkpoint with no next backup, diff against the PREVIOUS version's backup instead (hash@v(version-1)), which is the actual pre-edit state for that checkpoint. Applied in both the visibility check (checkpointWebviewProvider.ts) and the diff viewer (extension.ts).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Each backup snapshot reflects the post-edit state as of that checkpoint (it's identical to the live file right after that edit). For a file's last checkpoint in a session there's no "next" backup to diff against, so the existing fallback compared that checkpoint's own backup to the current file — which are always identical by construction. This hid the checkpoint entirely, and if opened anyway, showed an empty diff.
Fix
When a checkpoint has no next backup, diff against the previous version's backup (
hash@v(version-1)) instead — that's the actual pre-edit state for that checkpoint. Applied in both:checkpointWebviewProvider.ts(_hasTimelineDiff, decides whether the checkpoint is shown at all)extension.ts(viewDiffData, the actual diff view opened on click)Test plan
npm run compilepasses with no type errorsThis change (investigation, fix, and above PR description) was written by Claude (Anthropic). i'm not good in TypeScript or javascript but i did test the changes that were made and verified this as working.