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
16 lines · 678 BRaw
1import type Types from '../../types'
2
3/**
4 * Whether a path may predate the session at all: it was dirty when the
5 * baseline was read (the first fetch), or nothing says otherwise (none was).
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 = (context: Types.DatingContext, path: string) =>
16 context.deps.baseline?.has(path) ?? true