/** getGitLog 返回项的格式 */ export interface GitLogItem { /** hash 提交对象(commit)的完整哈希字串 */ H?: string; /** abbrevHash 提交对象的简短哈希字串 */ h?: string; /** treeHash 树对象(tree)的完整哈希字串 */ T?: string; /** abbrevTreeHash 树对象的简短哈希字串 */ t?: string; /** parentHashes 父对象(parent)的完整哈希字串 */ P?: string; /** abbrevParentHashes 父对象的简短哈希字串 */ p?: string; /** authorName 作者(author)的名字 */ an?: string; /** authorEmail 作者的电子邮件地址 */ ae?: string; /** authorDate 作者修订日期 */ ad?: string; /** authorDateRel 作者修订日期,按多久以前的方式显示 */ ar?: string; /** committerName 提交者(committer)的名字 */ cn?: string; /** committerEmail 提交者的电子邮件地址 */ ce?: string; /** committerDate 提交日期 */ cd?: string; /** committerDateRel 提交日期,按多久以前的方式显示 */ cr?: string; /** subject 提交说明 */ s?: string; } /** * 获取近 N 条日志的详细信息 * @param num 指定获取日志的数量 * @param cwd 工作目录 * @param filepath 指定获取日志的文件路径,可选 */ export declare function getGitLog(num?: number, cwd?: string, filepath?: string): GitLogItem[]; /** 【git】获取当前的本地分支名 */ export declare function getHeadBranch(baseDirectory?: string): string; /** 【git】获取本地或远端最新的 commitId */ export declare function getHeadCommitId(isRemote?: boolean, cwd?: string): string; /** 【git】获取本地或远端最新的 short commitId */ export declare function gitHashShort(length?: number, isRemote?: boolean, cwd?: string): string; /** * 【git】获取指定 HEAD 的变更文件列表 * @param headIndex HEAD 顺序,默认为 0,即最新的本地未提交变更 */ export declare function getHeadDiffFileList(headIndex?: number, cwd?: string, debug?: boolean): string[]; /** 【git】获取 git user eamil 地址 */ export declare function getUserEmail(): string; /** 【git】给文件增加或撤销可执行权限 */ export declare function gitSetChmod(filepath: string, type?: 'add' | 'del'): { stdout: string; stderr: string; error: Error; }; /** 判断给定的目录是否为一个 git 仓库 */ export declare function isGitRepo(rootDir?: string, useCache?: boolean): boolean; /** * 【git】是否存在未暂存的变更 * @param dir 指定具体的文件或目录路径。默认为当前目录 * @param cwd 工作目录 */ export declare function gitHasUnstagedChanges(dir?: string, cwd?: string): boolean; /** 获取 git 远程仓库地址 */ export declare function gitRemoteUrl(cwd?: string): string; /** 【git】是否存在未提交的变更 */ export declare function gitIsDirty(cwd?: string): boolean; /** 【git】最近一次的 tag 是否已过期(tag 之后存在新的提交) */ export declare function gitIsTagDirty(cwd?: string): boolean; /** 【git】获取最近一次的修改日期 */ export declare function gitDate(cwd?: string, filepath?: string): Date; /** 【git】获取最近一次的修改提交信息 */ export declare function gitMessage(cwd?: string, filepath?: string): string | undefined; /** 【git】获取历史提交总次数 */ export declare function gitCount(cwd?: string): number; /** * 【git】获取 .git 目录的绝对路径 * @param cwd 工作目录。默认为当前目录 */ export declare function gitDir(cwd?: string): string; /** * 【git】获取 git 项目根目录绝对路径 * @param cwd 工作目录。默认为当前目录 */ export declare function gitGetTopDir(cwd?: string): string; /** 【git】获取最新的 git tag */ export declare function gitGetTag(firstParent?: boolean, cwd?: string): string; /** 【git】获取全部的 tags 列表 */ export declare function gitGetAllTags(cwd?: string): string[];