fix(vcs): the Git Log rename label names the original directory (#3546)

The changed-file label trimmed a rename's old path to its base name, so a move between directories looked like a rename in place. A shared renameFrom() now says 'renamed from <name>' within one directory and 'moved from <old path relative to the new directory>' otherwise, as IDEA does; Git Log and the GitHub create / pull request change trees use it.

Closes #3529

Co-authored-by: Inf1mum <[email protected]>
Цей коміт міститься в:
Vadim LazukтаInf1mum authored and GitHub committed 2026-11-15 23:09:13 +08:00
1 джерело b7adbbb17c
коміт 55786a7030
7 files changed
+59 -6

No files matched your search

+2 -2
Переглянути файл
@@ -7,7 +7,7 @@
import { useMemo, useRef, useState, type MouseEvent, type ReactNode } from "react";
import { buildFileTree, dirKeys, type FileTreeNode } from "@/features/vcs/fileTree";
import { openDiff, withChain } from "@/features/vcs/diffInput";
import { KIND_COLOR, baseName, fileCount, type EffectiveKind } from "@/features/vcs/model";
import { KIND_COLOR, fileCount, renameFrom, type EffectiveKind } from "@/features/vcs/model";
import type { Commit } from "@/platform/ipc";
import { tx } from "@/platform/i18n";
import { Icon, IconButton, Spinner, T, Tree, fileIconName, showContextMenu, type MenuItem } from "@/ui";
@@ -252,7 +252,7 @@ function ChangeRow({ node }: { node: FileTreeNode<CreateChange> }) {
<span className={styles.fileName} style={{ color: KIND_COLOR[kindOf(f)] }}>
{node.name}
</span>
{f.oldPath && <span className={styles.fileDetail}>{tx`renamed from ${baseName(f.oldPath)}`}</span>}
{f.oldPath && <span className={styles.fileDetail}>{renameFrom(f.path, f.oldPath)}</span>}
</span>
);
}