SCM - do not show "View Commit" or "View All Changes" action for empty commits (#203381)

This commit is contained in:
Ladislau Szomoru 2024-01-24 21:15:51 +01:00 committed by GitHub
parent 1a94d0d635
commit 5b91204184
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

@ -1851,14 +1851,14 @@
"scm/incomingChanges/allChanges/context": [
{
"command": "git.viewAllChanges",
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
"group": "inline@1"
}
],
"scm/incomingChanges/historyItem/context": [
{
"command": "git.viewCommit",
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
"group": "inline@1"
}
],
@ -1872,14 +1872,14 @@
"scm/outgoingChanges/allChanges/context": [
{
"command": "git.viewAllChanges",
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
"group": "inline@1"
}
],
"scm/outgoingChanges/historyItem/context": [
{
"command": "git.viewCommit",
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
"group": "inline@1"
}
],

View file

@ -293,7 +293,11 @@ export class SCMHistoryProviderMenus implements ISCMHistoryProviderMenus, IDispo
MenuId.SCMOutgoingChangesHistoryItemContext;
}
result = this.menuService.createMenu(menuId, this.contextKeyService);
const contextKeyService = this.contextKeyService.createOverlay([
['scmHistoryItemFileCount', historyItem.statistics?.files ?? 0],
]);
result = this.menuService.createMenu(menuId, contextKeyService);
this.historyItemMenus.set(historyItem, result);
}