-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git repositories with spaces in their name are not recognized #1211
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Thanks @ardislu would you be willing to contribute fixing this? I can provide pointers |
@fcollonval Sure, I gave it a shot. I believe the issue is that the path ends up unescaped when it gets passed to various functions in But in this case, we actually want spaces to remain escaped because that's how the folder name is cloned. So my first pass to get it working was to update each Either like this: async def show_prefix(self, path):
cmd = ["git", "rev-parse", "--show-prefix"]
code, my_output, my_error = await execute(
cmd,
- cwd=path,
+ cwd=quote(path, safe=":/\\"),
) Or like this: async def branch(self, path):
+ path = quote(path, safe=":/\\")
heads = await self.branch_heads(path) This solution fixes this issue, but I don't think it's optimal:
Any suggestions? Thank you for your help on this. |
Thought about it some more and realized it'd be much easier and simpler to just move the same Edit: if two folders named I believe the root cause is that this URL:
Should only be decoded once to:
But there is some logic which decodes it again, so the actual string passed to the
However, I'm having a hard time finding where/how the URL is getting decoded twice. In local_path = os.path.join(os.path.expanduser(cm.root_dir), url2path(path)) But I can't see where it's getting decoded again before getting passed to |
Description
The git side panel does not recognize a git repo exists when you open a freshly-cloned repo that has spaces in its name.
For example: a repo with the name
repo with spaces in its name
is cloned to a folder namedrepo%20with%20spaces%20in%20its%20name
. All the files inside the folder are cloned as expected. However, opening the folder does not trigger the git side panel to recognize any git repo.Reproduce
Expected behavior
The repo is cloned successfully and the git side panel works as expected.
Actual behavior
The repo is cloned successfully with the spaces URL encoded in the folder name (i.e. "%20" instead of spaces). However, the git side panel does not detect any git repo inside the folder (it shows the default "You are not currently in a Git repository" page).
Workarounds
Workaround 1: Manually rename the folder to replace the "%20" encoding with spaces. After renaming the folder, the side panel works as expected.
Workaround 2: Open a new terminal and manually use the git CLI.
Context
The text was updated successfully, but these errors were encountered: