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,
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');
}

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

@ -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<GitLog | undefined> {
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<GitLog | undefined> {
@ -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<GitDocumentState>,

Loading…
Cancel
Save