file-util-git-history
Version:
Get a file's git history
28 lines (27 loc) • 1.04 kB
TypeScript
export type HistoryEntry = import("nodegit").Revwalk.HistoryEntry;
export type Options = {
/**
* predetermined git folder to get history from
*/
gitPath?: string;
};
/**
* Read this history of a file in source control
* @param {string} filePath - path to file
* @param {Options} [options] - optional predetermined gitPath
* @returns {Promise<HistoryEntry[]>} list of NodeGit commit objects
*/
export function gitHistory(filePath: string, options?: Options): Promise<HistoryEntry[]>;
/**
* Read this history of a file in source control
* @param {string} filePath - path to file
* @param {string} gitPath - path to git folder
* @returns {Promise<HistoryEntry[]>} list of NodeGit commit objects
*/
export function readHistory(filePath: string, gitPath: string): Promise<HistoryEntry[]>;
/**
* Find closest git parent of a file or folder
* @param {string} path - path to file or folder
* @returns {Promise<string>} path to git parent folder
*/
export function resolveGitFolder(path: string): Promise<string>;