Skip to content

Commit 0fe5034

Browse files
committed
Adds more logging
1 parent d92613e commit 0fe5034

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/env/node/git/sub-providers/commits.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ import { isRevisionRange, isSha, isUncommitted, isUncommittedStaged } from '../.
4949
import { isUserMatch } from '../../../../git/utils/user.utils';
5050
import { configuration } from '../../../../system/-webview/configuration';
5151
import { splitPath } from '../../../../system/-webview/path';
52-
import { log } from '../../../../system/decorators/log';
52+
import { debug, log } from '../../../../system/decorators/log';
5353
import { filterMap, first, join, last, some } from '../../../../system/iterable';
5454
import { Logger } from '../../../../system/logger';
5555
import { getLogScope } from '../../../../system/logger.scope';
5656
import { isFolderGlob, stripFolderGlob } from '../../../../system/path';
57+
import { maybeStopWatch } from '../../../../system/stopwatch';
5758
import type { CachedLog, TrackedGitDocument } from '../../../../trackers/trackedDocument';
5859
import { GitDocumentState } from '../../../../trackers/trackedDocument';
5960
import type { Git, GitResult } from '../git';
@@ -380,6 +381,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
380381
return this.getLogCore(repoPath, rev, options, cancellation);
381382
}
382383

384+
@debug({ args: { 2: false, 3: false, 4: false }, exit: true })
383385
private async getLogCore(
384386
repoPath: string,
385387
rev?: string | undefined,
@@ -1326,6 +1328,9 @@ async function parseCommits(
13261328
if (resultOrStream instanceof Promise) {
13271329
const result = await resultOrStream;
13281330

1331+
const scope = getLogScope();
1332+
using sw = maybeStopWatch(scope, { log: false, logLevel: 'debug' });
1333+
13291334
if (stashes?.size) {
13301335
const allowFilteredFiles = searchFilters?.files ?? false;
13311336
const stashesOnly = searchFilters?.type === 'stash';
@@ -1367,6 +1372,8 @@ async function parseCommits(
13671372
}
13681373
}
13691374

1375+
sw?.stop({ suffix: ` created ${count} commits` });
1376+
13701377
return { commits: commits, count: count, countStashChildCommits: countStashChildCommits };
13711378
}
13721379

src/views/nodes/branchNode.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { isStash } from '../../git/models/commit';
1313
import type { GitLog } from '../../git/models/log';
1414
import type { PullRequest, PullRequestState } from '../../git/models/pullRequest';
1515
import type { GitBranchReference } from '../../git/models/reference';
16-
import type { Repository } from '../../git/models/repository';
16+
import type { Repository, RepositoryChangeEvent } from '../../git/models/repository';
1717
import type { GitUser } from '../../git/models/user';
1818
import type { GitWorktree } from '../../git/models/worktree';
1919
import { getBranchAheadRange, getBranchMergeTargetName } from '../../git/utils/-webview/branch.utils';
@@ -780,9 +780,7 @@ export class CommitsCurrentBranchNode extends SubscribeableViewNode<'commits-cur
780780
const interval = getLastFetchedUpdateInterval(lastFetched);
781781
if (lastFetched !== 0 && interval > 0) {
782782
return Disposable.from(
783-
this.repo != null
784-
? weakEvent(this.repo.onDidChange, () => this.view.triggerNodeChange(this), this)
785-
: emptyDisposable,
783+
this.repo != null ? weakEvent(this.repo.onDidChange, this.onRepositoryChanged, this) : emptyDisposable,
786784
disposableInterval(() => {
787785
// Check if the interval should change, and if so, reset it
788786
if (interval !== getLastFetchedUpdateInterval(lastFetched)) {
@@ -796,4 +794,9 @@ export class CommitsCurrentBranchNode extends SubscribeableViewNode<'commits-cur
796794

797795
return undefined;
798796
}
797+
798+
@debug<CommitsCurrentBranchNode['onRepositoryChanged']>({ args: { 0: e => e.toString() } })
799+
private onRepositoryChanged(_e: RepositoryChangeEvent) {
800+
this.view.triggerNodeChange(this);
801+
}
799802
}

0 commit comments

Comments
 (0)