mirror of
https://github.com/anthropics/claude-code.git
synced 2026-09-14 19:48:39 +08:00
34 lines
955 B
TypeScript
34 lines
955 B
TypeScript
import Probes from '../probes'
|
|
import Tiers from '../tiers'
|
|
import type Types from '../types'
|
|
|
|
/**
|
|
* One fetch of the session's pinned repository, as the built-in panel
|
|
* fetches; every git child names it so paths stay root-relative.
|
|
*
|
|
* Mid-merge, mid-rebase, mid-cherry-pick or mid-revert, or when git cannot
|
|
* answer, it is unavailable and the caller keeps what it had.
|
|
*
|
|
* @param deps the host: pinned git, the repository, the file probes
|
|
* @param mode what to compare against
|
|
* @returns the outcome
|
|
*/
|
|
export async function fetchDiff(
|
|
deps: Types.GitDeps,
|
|
mode: Types.BaseMode,
|
|
): Promise<Types.FetchOutcome> {
|
|
const isBusy = await Probes.isTransient(
|
|
deps.entryKindsOf,
|
|
deps.repository.gitDir,
|
|
)
|
|
|
|
if (isBusy) {
|
|
return { kind: 'unavailable' }
|
|
}
|
|
|
|
const context = Tiers.fetchContextOf(deps, mode)
|
|
const isBranch = mode === 'branch'
|
|
|
|
return isBranch ? Tiers.branchTier(context) : Tiers.workingTreeTier(context)
|
|
}
|