mirror of
https://github.com/block/buzz.git
synced 2026-11-01 15:01:12 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user