Download mods/diff/tests/fixtures/git-in.ts from SaylorTwift/claude-code: direct link, hf CLI and curl.
- Browser
- Download file 841 Bytes
-
https://huggingface.co/SaylorTwift/claude-code/resolve/main/mods/diff/tests/fixtures/git-in.ts
- Command line
-
hf download hf://SaylorTwift/claude-code/mods/diff/tests/fixtures/git-in.ts
-
curl -L -o git-in.ts https://huggingface.co/SaylorTwift/claude-code/resolve/main/mods/diff/tests/fixtures/git-in.ts
841 Bytes
| import type { ProcessRunResult } from 'claude-code' | |
| import { NOT_A_REPOSITORY } from './not-a-repository.js' | |
| import { REPOSITORY } from './repository.js' | |
| /** | |
| * What git answers from a script of outputs by command-line key, REPOSITORY | |
| * when none is given. | |
| * | |
| * An invocation the script does not know fails as git does outside a | |
| * repository. | |
| * | |
| * @param argv the invocation, program first | |
| * @param script git's output for each invocation whose line holds the key | |
| * @returns git's exit code and output | |
| */ | |
| export function gitIn( | |
| argv: readonly string[], | |
| script: Readonly<Record<string, string>> = REPOSITORY, | |
| ): ProcessRunResult { | |
| const line = argv.join(' ') | |
| const found = Object.entries(script).find(([key]) => line.includes(key)) | |
| return found | |
| ? { exitCode: 0, stdout: found[1], stderr: '' } | |
| : NOT_A_REPOSITORY | |
| } | |