diff --git a/extensions/git/package.json b/extensions/git/package.json index 4ca0723655c..b0ba9c45f74 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -628,7 +628,7 @@ }, { "command": "git.rename", - "when": "false" + "when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && resourceScheme == file" }, { "command": "git.commit", @@ -1352,18 +1352,6 @@ "when": "config.git.enabled && !git.missing && timelineItem =~ /git:file:commit\\b/" } ], - "explorer/context": [ - { - "submenu": "git.explorer", - "group": "7_git", - "when": "config.git.enabled && !git.missing && !explorerResourceIsRoot" - } - ], - "git.explorer": [ - { - "command": "git.rename" - } - ], "git.commit": [ { "command": "git.commit", @@ -1582,10 +1570,6 @@ ] }, "submenus": [ - { - "id": "git.explorer", - "label": "%submenu.explorer%" - }, { "id": "git.commit", "label": "%submenu.commit%" diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index a63189d3f73..e086c22ffc3 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -766,7 +766,9 @@ export class CommandCenter { } @command('git.rename', { repository: true }) - async rename(repository: Repository, fromUri: Uri): Promise { + async rename(repository: Repository, fromUri: Uri | undefined): Promise { + fromUri = fromUri ?? window.activeTextEditor?.document.uri; + if (!fromUri) { return; }