mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
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 <8135225+Inf1mum@users.noreply.github.com>
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type MouseEvent } from "react";
|
||||
import clsx from "clsx";
|
||||
import { dirKeys, type FileTreeNode } from "@/features/vcs/fileTree";
|
||||
import { baseName, dirName, fileCount, KIND_COLOR } from "@/features/vcs/model";
|
||||
import { dirName, fileCount, KIND_COLOR, renameFrom } from "@/features/vcs/model";
|
||||
import { currentRepoRoot } from "@/features/vcs/store";
|
||||
import { useTx } from "@/platform/i18n";
|
||||
import { Icon, Tree, fileIconName, showContextMenu, T, type MenuItem, type TreeHandle } from "@/ui";
|
||||
@@ -202,7 +202,7 @@ function ChangeRow(props: {
|
||||
{node.name}
|
||||
</span>
|
||||
{flat && dirName(f.filename) && <span className={styles.fileDir}>{dirName(f.filename)}</span>}
|
||||
{f.previousFilename && <span className={styles.fileDir}>{tx`renamed from ${baseName(f.previousFilename)}`}</span>}
|
||||
{f.previousFilename && <span className={styles.fileDir}>{renameFrom(f.filename, f.previousFilename)}</span>}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user