From 66023e11e65760d18069ffe6d3d715752a24f8a2 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Mon, 8 Jan 2024 20:50:42 +0100 Subject: [PATCH] =?UTF-8?q?Git=20-=20=F0=9F=92=84=20clean-up=20summary=20g?= =?UTF-8?q?eneration=20(#202036)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/git/src/historyProvider.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) 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()); }