import type { Stats } from 'node:fs'; import type { LinkManifest } from './fan-out.manifest.js'; export { leftoverBackupWarning, listLeftoverBackups, recoverDestination, } from './fan-out.leftovers.js'; export { withDestinationLock, withFileLock } from './fan-out.locks.js'; /** Result of looking for `.git` at a directory's root. */ export type GitAtRoot = { kind: 'absent'; } | { kind: 'present'; } | { kind: 'unknown'; reason: string; }; /** * Look for a `.git` entry at the root of `p` with `lstat` (never following a * symlink, so a dangling `.git` link still counts). Any error other than * ENOENT/ENOTDIR is `unknown`, which callers must treat as "refuse". */ export declare function checkGitAtRoot(p: string): Promise; /** Refusal text for a git check that isn't `absent`, or `null` when it is. */ export declare function gitRefusal(p: string, check: GitAtRoot, verb: 'overwrite' | 'delete'): string | null; /** * Throw, changing nothing, unless the existing destination may be replaced: * a symlink (always disposable), or a copy recorded in the link manifest that * hasn't become a git working tree. */ export declare function assertOverwritable(dest: string, existing: Stats, manifest: LinkManifest): Promise; /** What {@link replaceDestination} put in place, and what it could not clean up. */ export interface PlacedDestination { /** * Identity of the entry now at `dest`, or null when this call cannot be * sure what it placed — round 21 (Opus): a published symlink that something * replaced between creating it and reading it back. A null identity means an * undo reports the write instead of deleting anything. */ placed: Stats | null; /** Warnings for the caller to surface, e.g. a superseded copy left behind. */ warnings: string[]; } /** * Replace (or create) `dest` with what `write` produces. The caller must hold * `withDestinationLock(dest)` and have checked `assertOverwritable`. `write` * receives a staging path; if it throws, the destination is never touched. * * Returns the identity of the entry now at `dest`. Round 15 (Opus): it is * taken from the staged entry before the swap, since a rename keeps device * and inode. Taken after the swap, it could record a folder another program * had put there in between, and an undo would then delete that folder. */ export declare function replaceDestination(dest: string, write: (stagedPath: string) => Promise): Promise; //# sourceMappingURL=fan-out.overwrite.d.ts.map