diff --git a/extensions/git/src/historyProvider.ts b/extensions/git/src/historyProvider.ts index 0e882103140..cd32a38c1aa 100644 --- a/extensions/git/src/historyProvider.ts +++ b/extensions/git/src/historyProvider.ts @@ -81,14 +81,16 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec const refParentId = options.limit.id; const refId = await this.repository.revParse(historyItemGroupId) ?? ''; - const [summary, commits] = await Promise.all([ - this.getSummaryHistoryItem(refId, refParentId), - this.repository.log({ range: `${refParentId}..${refId}`, shortStats: true, sortByAuthorDate: true }) - ]); + const historyItems: SourceControlHistoryItem[] = []; + const commits = await this.repository.log({ range: `${refParentId}..${refId}`, shortStats: true, sortByAuthorDate: true }); + + if (commits.length >= 2) { + const allChanges = await this.repository.diffBetweenShortStat(refParentId, refId); + historyItems.push({ id: refId, parentIds: [refParentId], icon: new ThemeIcon('files'), label: l10n.t('All Changes'), statistics: allChanges }); + } await ensureEmojis(); - const historyItems = commits.length < 2 ? [] : [summary]; historyItems.push(...commits.map(commit => { const newLineIndex = commit.message.indexOf('\n'); const subject = newLineIndex !== -1 ? commit.message.substring(0, newLineIndex) : commit.message; @@ -203,11 +205,6 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec return new FileDecoration(letter, tooltip, color); } - private async getSummaryHistoryItem(refId: string, refParentId: string): Promise { - const statistics = await this.repository.diffBetweenShortStat(refParentId, refId); - return { id: refId, parentIds: [refParentId], icon: new ThemeIcon('files'), label: l10n.t('All Changes'), statistics }; - } - dispose(): void { this.disposables.forEach(d => d.dispose()); }