Repository: spyder-ide/spyder

Issue:
Commit from files pane is not working.
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [ ] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [ ] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [ ] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [ ] Tried basic troubleshooting (if a bug/error)
    * [ ] Restarted Spyder
    * [ ] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [ ] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description



### What steps reproduce the problem?

1. Open a file from a GitHub repo. 
2. Make a change
3. Open context menu in files pane by pressing left click over the file
4. Click commit

### What is the expected output? What do you see instead?
Error dialog pops

<img width="1440" alt="Screenshot 2021-04-28 at 8 03 11 PM" src="https://user-images.githubusercontent.com/18587879/116491102-b27f2000-a85e-11eb-9105-e90aaab4abf3.png">



### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

PASTE TRACEBACK HERE

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: Spyder 5.1.0 dev0
* Python version: 3.8
* Qt version: 
* PyQt version: 
* Operating System name/version: MacOs

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
PASTE DEPENDENCIES HERE
```



Discussion:

Resolving patch:
diff --git a/spyder/plugins/explorer/widgets/explorer.py b/spyder/plugins/explorer/widgets/explorer.py
--- 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<br/> "
                     "following tools:<br/><br/>  %s")\


Test patch: