Download mods/diff/hooks/git/tiers/working-tree-tier.ts from SaylorTwift/claude-code: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/SaylorTwift/claude-code/resolve/main/mods/diff/hooks/git/tiers/working-tree-tier.ts
- Command line
-
hf download hf://SaylorTwift/claude-code/mods/diff/hooks/git/tiers/working-tree-tier.ts
-
curl -L -o working-tree-tier.ts https://huggingface.co/SaylorTwift/claude-code/resolve/main/mods/diff/hooks/git/tiers/working-tree-tier.ts
1.26 kB
| import Probes from '../probes' | |
| import type Types from '../types' | |
| import { diffDataOf } from './diff-data-of' | |
| import { unbornTier } from './unborn-tier' | |
| import { withUntracked } from './with-untracked' | |
| import { WORKING_TREE_BASIS } from './working-tree-basis' | |
| /** | |
| * Session and uncommitted mode: the working tree against HEAD, the built-in | |
| * panel's working-tree tier. | |
| * | |
| * Session mode tags the rows that predate the session and keeps | |
| * pre-session untracked files as tagged rows; uncommitted keeps the | |
| * session's untracked files and answers even when empty. | |
| * | |
| * @param context the fetch | |
| * @returns the outcome | |
| */ | |
| export async function workingTreeTier( | |
| context: Types.FetchContext, | |
| ): Promise<Types.FetchOutcome> { | |
| const workingTree = await Probes.statsOf(context, 'HEAD') | |
| if (!workingTree) { | |
| return unbornTier(context) | |
| } | |
| const isSession = context.mode === 'session' | |
| const files = isSession | |
| ? await Probes.tagPreSession(context, workingTree.files) | |
| : workingTree.files | |
| const data = diffDataOf( | |
| context, | |
| await withUntracked( | |
| context, | |
| { stats: workingTree.stats, files }, | |
| isSession ? 'with-pre-session' : 'session-only', | |
| ), | |
| WORKING_TREE_BASIS, | |
| ) | |
| return { kind: 'data', data } | |
| } | |