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 / probes / was-dirty-at-start / was-dirty-at-start.ts
18 lines · 682 BRaw
1import type Types from '../../types'
2
3/**
4 * Whether a path may predate the session at all: it was dirty when the
5 * session began, or nothing says otherwise (no baseline was read).
6 *
7 * A path missing from the baseline turned up since, so its old timestamp
8 * (a rename keeps the file's, a move keeps the source's) does not date it,
9 * as the built-in's change-time check does not let it.
10 *
11 * @param context the fetch's dating context
12 * @param path the root-relative path
13 * @returns false only when a baseline exists and lacks the path
14 */
15export const wasDirtyAtStart = (
16 context: Types.DatingContext,
17 path: string,
18): boolean => context.deps.baseline?.has(path) ?? true