import { GitProtocol } from "../../types/git.js"; import { CommitFilesConfig, CommitResult, LongCommitSha, PushFilesConfig, StatusResult, StorageConfig, TreeItem } from "./types.js"; import { RenovateConfig } from "../../config/types.js"; import { setNoVerify } from "./config.js"; import { setPrivateKey } from "./private-key.js"; import { DateTime } from "luxon"; //#region lib/util/git/index.d.ts declare const RENOVATE_FORK_UPSTREAM = "renovate-fork-upstream"; declare function gitRetry(gitFunc: () => Promise): Promise; declare const GIT_MINIMUM_VERSION = "2.33.0"; declare function validateGitVersion(): Promise; declare function fetchRevSpec(revSpec: string): Promise; declare function initRepo(args: StorageConfig): Promise; declare function resetToCommit(commit: LongCommitSha): Promise; declare function setGitAuthor(gitAuthor: string | undefined): void; declare function writeGitAuthor(): Promise; declare function setUserRepoConfig({ gitIgnoredAuthors, gitAuthor }: RenovateConfig): void; declare function getSubmodules(): Promise; declare function cloneSubmodules(shouldClone: boolean, cloneSubmodulesFilter: string[] | undefined): Promise; declare function isCloned(): boolean; declare const syncGit: () => Promise; declare function getRepoStatus(path?: string): Promise; declare function branchExists(branchName: string): boolean; declare function getBranchCommit(branchName: string): LongCommitSha | null; declare function getBranchUpdateDate(branchName: string): Promise; declare function getCommitMessages(): Promise; declare function checkoutBranch(branchName: string): Promise; declare function checkoutBranchFromRemote(branchName: string, remoteName: string): Promise; declare function resetHardFromRemote(remoteAndBranch: string): Promise; declare function forcePushToRemote(branchName: string, remote: string): Promise; declare function getFileList(): Promise; declare function getBranchList(): string[]; declare function isBranchBehindBase(branchName: string, baseBranch: string): Promise; declare function isBranchModified(branchName: string, baseBranch: string): Promise; declare function isBranchConflicted(baseBranch: string, branch: string): Promise; declare function deleteBranch(branchName: string): Promise; declare function mergeToLocal(refSpecToMerge: string): Promise; declare function mergeBranch(branchName: string): Promise; declare function getBranchLastCommitTime(branchName: string): Promise; declare function getBranchFiles(branchName: string): Promise; declare function getBranchFilesFromCommit(referenceCommit: LongCommitSha): Promise; declare function getFile(filePath: string, branchName?: string): Promise; declare function getFiles(fileNames: string[]): Promise>; declare function hasDiff(sourceRef: string, targetRef: string): Promise; /** * * Prepare local branch with commit * * 0. Hard reset * 1. Creates local branch with `origin/` prefix * 2. Perform `git add` (respecting mode) and `git remove` for each file * 3. Perform commit * 4. Check whether resulting commit is empty or not (due to .gitignore) * 5. If not empty, return commit info for further processing * */ declare function prepareCommit({ branchName, files, message, force }: CommitFilesConfig): Promise; declare function pushCommit({ sourceRef, targetRef, files, pushOptions }: PushFilesConfig): Promise; declare function fetchBranch(branchName: string): Promise; declare function commitFiles(commitConfig: CommitFilesConfig): Promise; declare function getUrl({ protocol, auth, hostname, host, repository }: { protocol?: GitProtocol; auth?: string; hostname?: string; host?: string; repository: string; }): string; /** * * Non-branch refs allow us to store git objects without triggering CI pipelines. * It's useful for API-based branch rebasing. * * @see https://stackoverflow.com/questions/63866947/pushing-git-non-branch-references-to-a-remote/63868286 * */ declare function pushCommitToRenovateRef(commitSha: string, refName: string): Promise; /** * * Removes all remote "refs/renovate/branches/*" refs in two steps: * * Step 1: list refs * * $ git ls-remote origin "refs/renovate/branches/*" * * > cca38e9ea6d10946bdb2d0ca5a52c205783897aa refs/renovate/branches/foo * > 29ac154936c880068994e17eb7f12da7fdca70e5 refs/renovate/branches/bar * > 3fafaddc339894b6d4f97595940fd91af71d0355 refs/renovate/branches/baz * > ... * * Step 2: * * $ git push --delete origin refs/renovate/branches/foo refs/renovate/branches/bar refs/renovate/branches/baz * * If Step 2 fails because the repo doesn't allow bulk changes, we'll remove them one by one instead: * * $ git push --delete origin refs/renovate/branches/foo * $ git push --delete origin refs/renovate/branches/bar * $ git push --delete origin refs/renovate/branches/baz */ declare function clearRenovateRefs(): Promise; /** * * Obtain top-level items of commit tree. * We don't need subtree items, so here are 2 steps only. * * Step 1: commit SHA -> tree SHA * * $ git cat-file -p * * > tree * > parent 59b8b0e79319b7dc38f7a29d618628f3b44c2fd7 * > ... * * Step 2: tree SHA -> tree items (top-level) * * $ git cat-file -p * * > 040000 tree 389400684d1f004960addc752be13097fe85d776 src * > ... * > 100644 blob 7d2edde437ad4e7bceb70dbfe70e93350d99c98b package.json * */ declare function listCommitTree(commitSha: LongCommitSha): Promise; /** * Synchronize a forked branch with its upstream counterpart. * * syncForkWithUpstream updates the fork's branch, to match the corresponding branch in the upstream repository. * The steps are: * 1. Check if the branch exists locally. * 2. If the branch exists locally: checkout the local branch. * 3. If the branch does _not_ exist locally: checkout the upstream branch. * 4. Reset the local branch to match the upstream branch. * 5. Force push the (updated) local branch to the origin repository. * * @param {string} branchName - The name of the branch to synchronize. * @returns A promise that resolves to True if the synchronization is successful, or `false` if an error occurs. */ declare function syncForkWithUpstream(branchName: string): Promise; declare function getRemotes(): Promise; //#endregion export { GIT_MINIMUM_VERSION, RENOVATE_FORK_UPSTREAM, branchExists, checkoutBranch, checkoutBranchFromRemote, clearRenovateRefs, cloneSubmodules, commitFiles, deleteBranch, fetchBranch, fetchRevSpec, forcePushToRemote, getBranchCommit, getBranchFiles, getBranchFilesFromCommit, getBranchLastCommitTime, getBranchList, getBranchUpdateDate, getCommitMessages, getFile, getFileList, getFiles, getRemotes, getRepoStatus, getSubmodules, getUrl, gitRetry, hasDiff, initRepo, isBranchBehindBase, isBranchConflicted, isBranchModified, isCloned, listCommitTree, mergeBranch, mergeToLocal, prepareCommit, pushCommit, pushCommitToRenovateRef, resetHardFromRemote, resetToCommit, setGitAuthor, setNoVerify, setPrivateKey, setUserRepoConfig, syncForkWithUpstream, syncGit, validateGitVersion, writeGitAuthor }; //# sourceMappingURL=index.d.ts.map