import type { PathSpec } from '../../../../types.ts';
import type { Files } from '../../../../workspace/files.ts';
export declare const GITIGNORE = ".gitignore";
/** One parsed `.gitignore` line. */
interface Rule {
    /** Matches the named path itself. */
    readonly self: RegExp;
    /** Matches anything below the named path, whatever type it is. */
    readonly under: RegExp;
    /** True for a `!` line, which un-ignores what the lines above caught. */
    readonly negated: boolean;
    /** True for a trailing `/`, which can only match a directory itself. */
    readonly dirOnly: boolean;
}
/**
 * The `.gitignore` files governing one directory, innermost last.
 *
 * Immutable, and pushed rather than mutated, so a walk hands each subdirectory
 * its own stack and cannot forget to pop one on the way back up.
 *
 * Precedence runs the opposite way to the list: a deeper file wins over a
 * shallower one, so the search runs from the end.
 */
export declare class IgnoreStack {
    private readonly filters;
    constructor(filters?: readonly [string, Rule[]][]);
    /**
     * A new stack with one more `.gitignore` on top.
     *
     * @param prefix the directory the file was found in, repository-relative
     * @param patterns the file's contents
     */
    push(prefix: string, patterns: Uint8Array): IgnoreStack;
    /**
     * Whether git would leave a path out of an untracked listing.
     *
     * @param path repository-relative path
     * @param isDir whether the path names a directory, which decides whether a
     *   `build/` pattern can match it
     */
    isIgnored(path: string, isDir?: boolean): boolean;
}
/**
 * The root of the ignore stack: the repository's own two files.
 *
 * `.git/info/exclude` sits below the root `.gitignore` because it is the
 * repository's private list and a tracked `.gitignore` should be able to
 * override it.
 *
 * `core.excludesFile`, the per-user global list, is deliberately not read. It
 * names a path on whichever machine git ran on, and a mount has no way to reach
 * that machine's home directory; honoring it would mean reading the operator's
 * own file and applying it to somebody else's repository.
 *
 * @param vfs the session's files
 * @param commondir the shared git directory, whose `info` a linked worktree
 *   reads too
 * @param worktree the working tree root
 */
export declare function loadIgnores(vfs: Files, commondir: PathSpec, worktree: PathSpec): Promise<IgnoreStack>;
export {};
//# sourceMappingURL=ignore.d.ts.map