diff --git a/spyder/plugins/explorer/widgets/explorer.py b/spyder/plugins/explorer/widgets/explorer.py
index e7078d61676..62f1bd1d6ee 100644
--- a/spyder/plugins/explorer/widgets/explorer.py
+++ b/spyder/plugins/explorer/widgets/explorer.py
@@ -598,8 +598,7 @@ def update_actions(self):
dirname = ''
basedir = ''
- vcs_visible = (only_files and len(fnames) == 1
- and vcs.is_vcs_repository(dirname))
+ vcs_visible = vcs.is_vcs_repository(dirname)
# Make actions visible conditionally
self.move_action.setVisible(
@@ -1443,9 +1442,17 @@ def check_launch_error_codes(self, return_codes):
def vcs_command(self, action):
"""VCS action (commit, browse)"""
fnames = self.get_selected_filenames()
+
+ # Get dirname of selection
+ if osp.isdir(fnames[0]):
+ dirname = fnames[0]
+ else:
+ dirname = osp.dirname(fnames[0])
+
+ # Run action
try:
for path in sorted(fnames):
- vcs.run_vcs_tool(path, action)
+ vcs.run_vcs_tool(dirname, action)
except vcs.ActionToolNotFound as error:
msg = _("For %s support, please install one of the
"
"following tools:
%s")\