Skip to content

Commit 78d09a8

Browse files
authored
SCM - improve history graph filtering (microsoft#223497)
1 parent 2da39bd commit 78d09a8

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

extensions/git/src/historyProvider.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
152152
]);
153153

154154
// Add common ancestor commit
155-
if (commits.length !== 0) {
156-
commits.push(mergeBaseCommit);
157-
}
155+
commits.push(mergeBaseCommit);
158156

159157
await ensureEmojis();
160158

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
114114
import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate';
115115
import { IWorkbenchLayoutService, Position } from 'vs/workbench/services/layout/browser/layoutService';
116116
import { fromNow } from 'vs/base/common/date';
117+
import { equals } from 'vs/base/common/arrays';
117118

118119
// type SCMResourceTreeNode = IResourceNode<ISCMResource, ISCMResourceGroup>;
119120
// type SCMHistoryItemChangeResourceTreeNode = IResourceNode<SCMHistoryItemChangeTreeElement, SCMHistoryItemTreeElement>;
@@ -4124,6 +4125,23 @@ class SCMTreeHistoryProviderDataSource extends Disposable {
41244125
});
41254126
}
41264127

4128+
// If we only have one history item that contains all the
4129+
// labels (current, remote, base), we don't need to show it
4130+
if (historyItemsElement.length === 1) {
4131+
const currentHistoryItemGroupLabels = [
4132+
currentHistoryItemGroup.name,
4133+
...currentHistoryItemGroup.remote ? [currentHistoryItemGroup.remote.name] : [],
4134+
...currentHistoryItemGroup.base ? [currentHistoryItemGroup.base.name] : [],
4135+
];
4136+
4137+
const labels = (historyItemsElement[0].labels ?? [])
4138+
.map(l => l.title);
4139+
4140+
if (equals(currentHistoryItemGroupLabels.sort(), labels.sort())) {
4141+
return [];
4142+
}
4143+
}
4144+
41274145
// Create the color map
41284146
const colorMap = new Map<string, ColorIdentifier>([
41294147
[currentHistoryItemGroup.name, historyItemGroupLocal]

0 commit comments

Comments
 (0)