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) <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
This commit is contained in:
Matt Toohey
2026-05-12 09:40:37 +10:00
committed by Mesh-LLM CI
parent a088822b5b
commit 4bca6e10e8

View File

@@ -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) {