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 / is-sha / is-sha.ts
9 lines · 335 BRaw
1/**
2 * Whether git printed an object name: 40 or 64 lowercase hex digits, the
3 * only shape a merge-base may take before it reaches a `git diff` argv.
4 *
5 * @param text one trimmed line of git output
6 * @returns whether it is a full object name
7 */
8export const isSha = (text: string) =>
9 /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(text)