import AsyncLock from "async-lock"; import fsExtra from "fs-extra"; import type { GrowError } from "@garden-io/grow-sdk/errors"; import { ChildProcessError } from "@garden-io/grow-sdk/errors"; import type { Log } from "../logger/log-entry"; import { VcsHandler } from "./vcs"; import type { RemoteSourceParams, VcsHandlerParams, VcsInfo } from "./vcs"; export declare function getCommitIdFromRefList(refList: string[]): string; export declare function parseGitUrl(url: string): { repositoryUrl: string; hash: string; }; type GitCliParams = { log: Log; cwd: string; failOnPrompt?: boolean; }; export declare class GitCli { private readonly git; private readonly log; constructor(params: GitCliParams); exec(...args: string[]): Promise; getModifiedFiles(path: string): Promise; getLastCommitHash(): Promise; getRepositoryRoot(): Promise; getBranchName(): Promise; getOriginUrl(): Promise; getPathInfo(): Promise; } export declare abstract class AbstractGitHandler extends VcsHandler { private readonly repoRoots; protected readonly lock: AsyncLock; protected constructor(params: VcsHandlerParams); getRepoRoot(log: Log, path: string, failOnPrompt?: boolean): Promise; private cloneRemoteSource; ensureRemoteSource({ url, name, log, sourceType, failOnPrompt }: RemoteSourceParams): Promise; updateRemoteSource({ url, name, sourceType, log, failOnPrompt }: RemoteSourceParams): Promise; private withRemoteSourceLock; getPathInfo(log: Log, path: string, failOnPrompt?: boolean): Promise; } /** * Replicates the `git hash-object` behavior. See https://stackoverflow.com/a/5290484/3290965 * We deviate from git's behavior when dealing with symlinks, by hashing the target of the symlink and not the * symlink itself. If the symlink cannot be read, we hash the link contents like git normally does. */ export declare function hashObject(stats: fsExtra.Stats, path: string): Promise; export declare function explainGitError(err: ChildProcessError, path: string): GrowError; /** * Given a list of POSIX-style globs/paths and a `basePath`, find paths that point to a directory and append `**\/*` * to them, such that they'll be matched consistently between git and our internal pattern matching. */ export declare function augmentGlobs(basePath: string, globs: string[]): Promise; export declare function augmentGlobs(basePath: string, globs?: string[]): Promise; export declare function getPathInfo(log: Log, path: string, failOnPrompt?: boolean): Promise; export {};