Browse Source

Adds since support to git log

main
Eric Amodio 4 years ago
parent
commit
36e048e933
2 changed files with 27 additions and 1 deletions
  1. +12
    -0
      src/git/git.ts
  2. +15
    -1
      src/git/gitService.ts

+ 12
- 0
src/git/git.ts View File

@ -706,12 +706,14 @@ export namespace Git {
merges, merges,
reverse, reverse,
similarityThreshold, similarityThreshold,
since,
}: { }: {
authors?: string[]; authors?: string[];
limit?: number; limit?: number;
merges?: boolean; merges?: boolean;
reverse?: boolean; reverse?: boolean;
similarityThreshold?: number | null; similarityThreshold?: number | null;
since?: string;
}, },
) { ) {
const params = [ const params = [
@ -726,6 +728,10 @@ export namespace Git {
params.push(`-n${limit + 1}`); params.push(`-n${limit + 1}`);
} }
if (since) {
params.push(`--since="${since}"`);
}
if (!merges) { if (!merges) {
params.push('--first-parent'); params.push('--first-parent');
} }
@ -761,6 +767,7 @@ export namespace Git {
firstParent = false, firstParent = false,
renames = true, renames = true,
reverse = false, reverse = false,
since,
skip, skip,
format = 'default', format = 'default',
startLine, startLine,
@ -772,6 +779,7 @@ export namespace Git {
firstParent?: boolean; firstParent?: boolean;
renames?: boolean; renames?: boolean;
reverse?: boolean; reverse?: boolean;
since?: string;
skip?: number; skip?: number;
format?: 'refs' | 'simple' | 'default'; format?: 'refs' | 'simple' | 'default';
startLine?: number; startLine?: number;
@ -793,6 +801,10 @@ export namespace Git {
params.push(`--skip=${skip}`); params.push(`--skip=${skip}`);
} }
if (since) {
params.push(`--since="${since}"`);
}
if (all) { if (all) {
params.push('--all'); params.push('--all');
} }

+ 15
- 1
src/git/gitService.ts View File

@ -1613,7 +1613,14 @@ export class GitService implements Disposable {
{ {
ref, ref,
...options ...options
}: { authors?: string[]; limit?: number; merges?: boolean; ref?: string; reverse?: boolean } = {},
}: {
authors?: string[];
limit?: number;
merges?: boolean;
ref?: string;
reverse?: boolean;
since?: string;
} = {},
): Promise<GitLog | undefined> { ): Promise<GitLog | undefined> {
const limit = options.limit ?? Container.config.advanced.maxListItems ?? 0; 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, merges: options.merges == null ? true : options.merges,
reverse: options.reverse, reverse: options.reverse,
similarityThreshold: Container.config.advanced.similarityThreshold, similarityThreshold: Container.config.advanced.similarityThreshold,
since: options.since,
}); });
const log = GitLogParser.parse( const log = GitLogParser.parse(
data, data,
@ -1883,6 +1891,7 @@ export class GitService implements Disposable {
ref?: string; ref?: string;
renames?: boolean; renames?: boolean;
reverse?: boolean; reverse?: boolean;
since?: string;
skip?: number; skip?: number;
} = {}, } = {},
): Promise<GitLog | undefined> { ): Promise<GitLog | undefined> {
@ -1923,6 +1932,10 @@ export class GitService implements Disposable {
key += ':reverse'; key += ':reverse';
} }
if (options.since) {
key += `:since=${options.since}`;
}
if (options.skip) { if (options.skip) {
key += `:skip${options.skip}`; key += `:skip${options.skip}`;
} }
@ -2028,6 +2041,7 @@ export class GitService implements Disposable {
ref?: string; ref?: string;
renames?: boolean; renames?: boolean;
reverse?: boolean; reverse?: boolean;
since?: string;
skip?: number; skip?: number;
}, },
document: TrackedDocument<GitDocumentState>, document: TrackedDocument<GitDocumentState>,

Loading…
Cancel
Save