From 36e048e933e52acf9938ac8d0cc43fb720506207 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 1 Oct 2020 01:41:22 -0400 Subject: [PATCH] Adds since support to git log --- src/git/git.ts | 12 ++++++++++++ src/git/gitService.ts | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/git/git.ts b/src/git/git.ts index 79a8a9b..0d3edac 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -706,12 +706,14 @@ export namespace Git { merges, reverse, similarityThreshold, + since, }: { authors?: string[]; limit?: number; merges?: boolean; reverse?: boolean; similarityThreshold?: number | null; + since?: string; }, ) { const params = [ @@ -726,6 +728,10 @@ export namespace Git { params.push(`-n${limit + 1}`); } + if (since) { + params.push(`--since="${since}"`); + } + if (!merges) { params.push('--first-parent'); } @@ -761,6 +767,7 @@ export namespace Git { firstParent = false, renames = true, reverse = false, + since, skip, format = 'default', startLine, @@ -772,6 +779,7 @@ export namespace Git { firstParent?: boolean; renames?: boolean; reverse?: boolean; + since?: string; skip?: number; format?: 'refs' | 'simple' | 'default'; startLine?: number; @@ -793,6 +801,10 @@ export namespace Git { params.push(`--skip=${skip}`); } + if (since) { + params.push(`--since="${since}"`); + } + if (all) { params.push('--all'); } diff --git a/src/git/gitService.ts b/src/git/gitService.ts index 68292e5..a6a956f 100644 --- a/src/git/gitService.ts +++ b/src/git/gitService.ts @@ -1613,7 +1613,14 @@ export class GitService implements Disposable { { ref, ...options - }: { authors?: string[]; limit?: number; merges?: boolean; ref?: string; reverse?: boolean } = {}, + }: { + authors?: string[]; + limit?: number; + merges?: boolean; + ref?: string; + reverse?: boolean; + since?: string; + } = {}, ): Promise { const limit = options.limit ?? Container.config.advanced.maxListItems ?? 0; @@ -1624,6 +1631,7 @@ export class GitService implements Disposable { merges: options.merges == null ? true : options.merges, reverse: options.reverse, similarityThreshold: Container.config.advanced.similarityThreshold, + since: options.since, }); const log = GitLogParser.parse( data, @@ -1883,6 +1891,7 @@ export class GitService implements Disposable { ref?: string; renames?: boolean; reverse?: boolean; + since?: string; skip?: number; } = {}, ): Promise { @@ -1923,6 +1932,10 @@ export class GitService implements Disposable { key += ':reverse'; } + if (options.since) { + key += `:since=${options.since}`; + } + if (options.skip) { key += `:skip${options.skip}`; } @@ -2028,6 +2041,7 @@ export class GitService implements Disposable { ref?: string; renames?: boolean; reverse?: boolean; + since?: string; skip?: number; }, document: TrackedDocument,