Enable the .. argument for git log (#188500)

* Enable the `..` argument for git log
This will return the commits that the `toRef` has but the `fromRef` does not.

* Use range instead
This commit is contained in:
Alex Ross
2023-09-04 14:36:16 +02:00
committed by GitHub
parent 5f935919c6
commit 1ac6f50f44
2 changed files with 10 additions and 1 deletions
+2
View File
@@ -129,6 +129,8 @@ export interface LogOptions {
/** Max number of log entries to retrieve. If not specified, the default is 32. */
readonly maxEntries?: number;
readonly path?: string;
/** A commit range, such as "0a47c67f0fb52dd11562af48658bc1dff1d75a38..0bb4bdea78e1db44d728fd6894720071e303304f" */
readonly range?: string;
}
export interface CommitOptions {
+8 -1
View File
@@ -1022,7 +1022,14 @@ export class Repository {
async log(options?: LogOptions): Promise<Commit[]> {
const maxEntries = options?.maxEntries ?? 32;
const args = ['log', `-n${maxEntries}`, `--format=${COMMIT_FORMAT}`, '-z', '--'];
const args = ['log', `-n${maxEntries}`, `--format=${COMMIT_FORMAT}`, '-z'];
if (options?.range) {
args.push(options.range);
}
args.push('--');
if (options?.path) {
args.push(options.path);
}