fix(desktop): stop showing /dev/null in diff labels, keep type badge visible#1704
Merged
Conversation
For new/deleted files, git diffs use /dev/null as the absent path. getDiffFileLabel was showing labels like "/dev/null -> path/to/file". Treat /dev/null as an absent path so only the real file path is shown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
The /dev/null label fix made getDiffFileLabel return the bare file path for new/deleted files, which now matches fallbackFilePath in single-file diffs — so showFileHeader skipped the per-file header entirely, hiding the New file/Deleted type badge and the +/- change counts. Show the header whenever the diff type is notable (add/delete/rename/ copy), while still collapsing it for plain modifications where it would only repeat the path shown in the card header. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
…is collapsed Instead of forcing the per-file header open just to show the New file/Deleted badge (previous fix), keep the header collapsed when it would only repeat the card title, and show the badge in the diff card's title bar instead — both in the inline DiffMessage card and the expanded dialog. DIFF_TYPE_LABELS and the header-visibility check move into parseDiff.ts as shared helpers, and a new getDiffTitleBadge returns the badge label only for single-file diffs whose collapsed header has a notable change type — so the badge never renders in both places. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
…-side actions The title span's flex-1 stretched it across the row, pushing the type badge over to the commit SHA on the right. Match the per-file header layout instead: the badge sits immediately after the (truncating) file path, and the SHA/repo link/expand button — or the view toggle in the expanded dialog — are grouped and pushed right with ml-auto. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
Contributor
Author
|
🤖 Screenshots posted by Matt's AI agent. Inline diff cardNew-file diff (kind 40008) with a Expanded dialogSame placement in the expanded viewer — badge beside the title, Unified/Split toggle pushed right. |
baxen
approved these changes
Jul 10, 2026
This was referenced Jul 10, 2026
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
Diff message cards showed
/dev/nullas if it were a real path — new files rendered labels like/dev/null -> path/to/file(and deleted files the reverse). This PR cleans up the label and reworks where the New file/Deleted type badge lives so it never disappears.Changes
getDiffFileLabeltreats/dev/nullas an absent path — new files show just the new path, deleted files just the old path; the->arrow only appears for genuine renames/copies.getDiffTitleBadgehelper surfaces the badge in the card title (inline card and expanded dialog) exactly when the header is hidden and the change type is notable, so the badge renders in exactly one place.ml-auto.DIFF_TYPE_LABELSand the header-visibility check moved intoparseDiff.tsas shared helpers so the title badge and header can't drift out of sync.Testing
just desktop-check,just desktop-typecheck,just desktop-test(2270 tests) all pass.react-diff-viewparser: badge shows in the title only for single-file notable-type diffs whose header is collapsed; header (with its own badge) still renders for multi-file diffs, missing/mismatchedfilePath, and renames.just desktop-screenshotwith an injected kind-40008 new-file diff message.🤖 Generated with Claude Code