Skip to content

Commit

Permalink
Adds using support & removes classes for parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Oct 16, 2023
1 parent 1dbd860 commit e6b3c96
Show file tree
Hide file tree
Showing 20 changed files with 1,272 additions and 1,326 deletions.
2 changes: 1 addition & 1 deletion src/annotations/gutterBlameAnnotationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
const blame = await this.getBlame();
if (blame == null) return false;

const sw = maybeStopWatch(scope);
using sw = maybeStopWatch(scope);

const cfg = configuration.get('blame');

Expand Down
2 changes: 1 addition & 1 deletion src/annotations/gutterChangesAnnotationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase<Chan
).filter(<T>(d?: T): d is T => Boolean(d));
if (!diffs?.length) return false;

const sw = maybeStopWatch(scope);
using sw = maybeStopWatch(scope);

const decorationsMap = new Map<
string,
Expand Down
2 changes: 1 addition & 1 deletion src/annotations/gutterHeatmapBlameAnnotationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class GutterHeatmapBlameAnnotationProvider extends BlameAnnotationProvide
const blame = await this.getBlame();
if (blame == null) return false;

const sw = maybeStopWatch(scope);
using sw = maybeStopWatch(scope);

const decorationsMap = new Map<
string,
Expand Down
22 changes: 11 additions & 11 deletions src/env/node/git/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import type { GitDir } from '../../../git/gitProvider';
import type { GitDiffFilter } from '../../../git/models/diff';
import { isUncommitted, isUncommittedStaged, shortenRevision } from '../../../git/models/reference';
import type { GitUser } from '../../../git/models/user';
import { GitBranchParser } from '../../../git/parsers/branchParser';
import { GitLogParser } from '../../../git/parsers/logParser';
import { GitReflogParser } from '../../../git/parsers/reflogParser';
import { parseGitBranchesDefaultFormat } from '../../../git/parsers/branchParser';
import { parseGitLogAllFormat, parseGitLogDefaultFormat } from '../../../git/parsers/logParser';
import { parseGitRefLogDefaultFormat } from '../../../git/parsers/reflogParser';
import { parseGitRemoteUrl } from '../../../git/parsers/remoteParser';
import { GitTagParser } from '../../../git/parsers/tagParser';
import { parseGitTagsDefaultFormat } from '../../../git/parsers/tagParser';
import { splitAt } from '../../../system/array';
import { configuration } from '../../../system/configuration';
import { log } from '../../../system/decorators/log';
Expand Down Expand Up @@ -1011,7 +1011,7 @@ export class Git {
}

for_each_ref__branch(repoPath: string, options: { all: boolean } = { all: false }) {
const params = ['for-each-ref', `--format=${GitBranchParser.defaultFormat}`, 'refs/heads'];
const params = ['for-each-ref', `--format=${parseGitBranchesDefaultFormat}`, 'refs/heads'];
if (options.all) {
params.push('refs/remotes');
}
Expand Down Expand Up @@ -1045,7 +1045,7 @@ export class Git {
},
) {
if (argsOrFormat == null) {
argsOrFormat = ['--name-status', `--format=${all ? GitLogParser.allFormat : GitLogParser.defaultFormat}`];
argsOrFormat = ['--name-status', `--format=${all ? parseGitLogAllFormat : parseGitLogDefaultFormat}`];
}

if (typeof argsOrFormat === 'string') {
Expand Down Expand Up @@ -1242,7 +1242,7 @@ export class Git {
const [file, root] = splitPath(fileName, repoPath, true);

if (argsOrFormat == null) {
argsOrFormat = [`--format=${all ? GitLogParser.allFormat : GitLogParser.defaultFormat}`];
argsOrFormat = [`--format=${all ? parseGitLogAllFormat : parseGitLogDefaultFormat}`];
}

if (typeof argsOrFormat === 'string') {
Expand Down Expand Up @@ -1438,7 +1438,7 @@ export class Git {
'show',
'--stdin',
'--name-status',
`--format=${GitLogParser.defaultFormat}`,
`--format=${parseGitLogDefaultFormat}`,
'--use-mailmap',
);
}
Expand All @@ -1451,7 +1451,7 @@ export class Git {
'log',
...(options?.stdin ? ['--stdin'] : emptyArray),
'--name-status',
`--format=${GitLogParser.defaultFormat}`,
`--format=${parseGitLogDefaultFormat}`,
'--use-mailmap',
...search,
...(options?.ordering ? [`--${options.ordering}-order`] : emptyArray),
Expand Down Expand Up @@ -1542,7 +1542,7 @@ export class Git {
skip?: number;
} = {},
): Promise<string> {
const params = ['log', '--walk-reflogs', `--format=${GitReflogParser.defaultFormat}`, '--date=iso8601'];
const params = ['log', '--walk-reflogs', `--format=${parseGitRefLogDefaultFormat}`, '--date=iso8601'];

if (ordering) {
params.push(`--${ordering}-order`);
Expand Down Expand Up @@ -2139,7 +2139,7 @@ export class Git {
}

tag(repoPath: string) {
return this.git<string>({ cwd: repoPath }, 'tag', '-l', `--format=${GitTagParser.defaultFormat}`);
return this.git<string>({ cwd: repoPath }, 'tag', '-l', `--format=${parseGitTagsDefaultFormat}`);
}

worktree__add(
Expand Down
Loading

0 comments on commit e6b3c96

Please sign in to comment.