Skip to content

Commit 5b91204

Browse files
authored
SCM - do not show "View Commit" or "View All Changes" action for empty commits (microsoft#203381)
1 parent 1a94d0d commit 5b91204

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

extensions/git/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,14 +1851,14 @@
18511851
"scm/incomingChanges/allChanges/context": [
18521852
{
18531853
"command": "git.viewAllChanges",
1854-
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
1854+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
18551855
"group": "inline@1"
18561856
}
18571857
],
18581858
"scm/incomingChanges/historyItem/context": [
18591859
{
18601860
"command": "git.viewCommit",
1861-
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
1861+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
18621862
"group": "inline@1"
18631863
}
18641864
],
@@ -1872,14 +1872,14 @@
18721872
"scm/outgoingChanges/allChanges/context": [
18731873
{
18741874
"command": "git.viewAllChanges",
1875-
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
1875+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
18761876
"group": "inline@1"
18771877
}
18781878
],
18791879
"scm/outgoingChanges/historyItem/context": [
18801880
{
18811881
"command": "git.viewCommit",
1882-
"when": "scmProvider == git && config.multiDiffEditor.experimental.enabled",
1882+
"when": "scmProvider == git && scmHistoryItemFileCount != 0 && config.multiDiffEditor.experimental.enabled",
18831883
"group": "inline@1"
18841884
}
18851885
],

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,11 @@ export class SCMHistoryProviderMenus implements ISCMHistoryProviderMenus, IDispo
293293
MenuId.SCMOutgoingChangesHistoryItemContext;
294294
}
295295

296-
result = this.menuService.createMenu(menuId, this.contextKeyService);
296+
const contextKeyService = this.contextKeyService.createOverlay([
297+
['scmHistoryItemFileCount', historyItem.statistics?.files ?? 0],
298+
]);
299+
300+
result = this.menuService.createMenu(menuId, contextKeyService);
297301
this.historyItemMenus.set(historyItem, result);
298302
}
299303

0 commit comments

Comments
 (0)