From 4bca6e10e82b297ae9b9c390db2fa1fe4788e74f Mon Sep 17 00:00:00 2001 From: Matt Toohey Date: Tue, 12 May 2026 09:40:37 +1000 Subject: [PATCH] fix(desktop): filter /dev/null from diff file labels 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) Signed-off-by: Matt Toohey --- desktop/src/features/messages/lib/parseDiff.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/desktop/src/features/messages/lib/parseDiff.ts b/desktop/src/features/messages/lib/parseDiff.ts index a44dc62ec7..b65c1e63cd 100644 --- a/desktop/src/features/messages/lib/parseDiff.ts +++ b/desktop/src/features/messages/lib/parseDiff.ts @@ -37,11 +37,14 @@ export function getDiffFileLabel( file: FileData, fallbackFilePath?: string, ): string { - if (file.oldPath && file.newPath && file.oldPath !== file.newPath) { - return `${file.oldPath} -> ${file.newPath}`; + const oldPath = file.oldPath === "/dev/null" ? undefined : file.oldPath; + const newPath = file.newPath === "/dev/null" ? undefined : file.newPath; + + if (oldPath && newPath && oldPath !== newPath) { + return `${oldPath} -> ${newPath}`; } - return file.newPath || file.oldPath || fallbackFilePath || "diff"; + return newPath || oldPath || fallbackFilePath || "diff"; } export function countDiffFileChanges(file: FileData) {