Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git - Add operation start/end trace log #164242

Merged
merged 1 commit into from Oct 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions extensions/git/src/repository.ts
Expand Up @@ -397,11 +397,15 @@ class OperationsImpl implements Operations {

private operations = new Map<Operation, number>();

constructor(private readonly logger: LogOutputChannel) { }

start(operation: Operation): void {
this.logger.trace(`Operation start: ${operation}`);
this.operations.set(operation, (this.operations.get(operation) || 0) + 1);
}

end(operation: Operation): void {
this.logger.trace(`Operation end: ${operation}`);
const count = (this.operations.get(operation) || 0) - 1;

if (count <= 0) {
Expand Down Expand Up @@ -859,7 +863,7 @@ export class Repository implements Disposable {
return this._mergeInProgress;
}

private _operations = new OperationsImpl();
private _operations = new OperationsImpl(this.logger);
get operations(): Operations { return this._operations; }

private _state = RepositoryState.Idle;
Expand Down Expand Up @@ -901,7 +905,7 @@ export class Repository implements Disposable {
remoteSourcePublisherRegistry: IRemoteSourcePublisherRegistry,
postCommitCommandsProviderRegistry: IPostCommitCommandsProviderRegistry,
globalState: Memento,
logger: LogOutputChannel,
private readonly logger: LogOutputChannel,
private telemetryReporter: TelemetryReporter
) {
const repositoryWatcher = workspace.createFileSystemWatcher(new RelativePattern(Uri.file(repository.root), '**'));
Expand Down