/** * Generic extensions to the simple-git library. */ import doCreateGit from 'simple-git/promise'; export declare type Simple = ReturnType; export declare function createGit(): Simple; /** * Get tags at the given commit or HEAD by default. */ export declare function gitGetTags(git: Simple, opts?: { ref?: string; }): Promise; /** * Get all tags in the git repo. */ export declare function gitGetTagsInRepo(git: Simple): Promise; /** * Reset a git repository to its last commit, removing staged files, cleaning * dirty working directory, etc. */ export declare function gitReset(git: Simple): Promise; /** * Reset a git repository to its initial commit */ export declare function gitResetToInitialCommit(git: Simple): Promise; /** * Get the SHA at the given commit or HEAD by default. By default returns the * full SHA. */ export declare function gitGetSha(git: Simple, opts?: { short?: boolean; ref?: string; }): Promise; /** * Reset not only the working directory but the git repo itself. */ export declare function gitInitRepo(git: Simple): Promise; /** * Create an empty commit in the repo. */ export declare function gitCreateEmptyCommit(git: Simple, messge?: string): Promise; export declare function createFixCommit(git: Simple, msg?: string): Promise; export declare function createFeatCommit(git: Simple, msg?: string): Promise; /** * Delete all tags in the repo. */ export declare function gitDeleteAllTagsInRepo(git: Simple): Promise; declare type SyncStatus = 'needs_pull' | 'needs_push' | 'synced' | 'diverged' | 'remote_needs_branch'; /** * Check how the local branch is not in sync or is with the remote. * Ref: https://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git */ export declare function checkSyncStatus(git: Simple): Promise; export interface BasicGithubRepoInfo { name: string; owner: string; } /** * Extract the github repo name and owner from the git config. If anything goes * wrong during extraction a specific error about it will be thrown. */ export declare function parseGithubRepoInfoFromGitConfig(): Promise; /** * Determin if the current branch is trunk or not. Currently a simple check * against if current branch is master or not but TODO in the future will * account for checking against the remote Git repo for if the so-called `base` * branch of the repo is set to something else than `master`. */ export declare function isTrunk(git: Simple): Promise; /** * Get the last tag in the current branch that matches the given pattern. * Returns null if no tag can be found. */ export declare function findTag(git: Simple, ops: { matcher: (x: string) => boolean; since?: string; }): Promise; export declare type LogEntryWithRefs = { sha: string; refs: string; message: string; }; export declare type LogEntry = { sha: string; tags: string[]; message: string; }; /** * Fetch commit log from given ref or else its entirety. The since commit is * inclusive. If given, it will be in your result set. Oldest commit comes first. */ export declare function log(git: Simple, ops?: { since?: null | string; }): Promise; declare type CommitDatum = { name: string; code: 'H' | 'D' | 's' | 'b' | 'B'; }; export declare const commitDatums: CommitDatum[]; export declare function gitLogFormat(commitDatums: CommitDatum[]): string; export declare function parseRawLog(rawLog: string): LogEntryWithRefs[]; export declare function parseRawLogEntry(rawLogEntry: string): LogEntryWithRefs; /** * Parse a raw git log into a list of structured commit entries. The given * rawLog should be newest commits first, as per how git log returns items (ref: * https://stackoverflow.com/questions/18659959/git-tag-sorted-in-chronological-order-of-the-date-of-the-commit-pointed-to#comment95151860_36636526). * In turn, the items are here flipped so that oldest commits are first. */ export declare function parseLogRefs({ refs, ...rest }: LogEntryWithRefs): LogEntry; /** * Lightweight utility to build up a raw log from semi-structured commit input. * Useful for creating mock data. Not very safe. Requires tuple members to be in * the exact order as the datums in this module. Hence this is for testing, not * external consumption. */ export declare function serializeLog(values: [string, string, string][]): string; export declare function streamLog(opts?: { cwd?: string; }): AsyncGenerator; export {}; //# sourceMappingURL=git.d.ts.map