spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / git / display-path-of / display-path-of.ts
17 lines · 514 BRaw
1import { renameDisplayOf } from '../rename-display-of'
2import type Types from '../types'
3
4/**
5 * A row's name as the built-in lists it: the path, or for a rename the one
6 * line `git diff --stat` prints for it (renameDisplayOf).
7 *
8 * @param file the row
9 * @returns the name to draw and to sort by
10 */
11export function displayPathOf(
12 file: Pick<Types.FileStat, 'path' | 'renamedFrom'>,
13): string {
14 const { renamedFrom, path } = file
15
16 return renamedFrom === null ? path : renameDisplayOf(renamedFrom, path)
17}