-
Notifications
You must be signed in to change notification settings - Fork 140
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
Issues with special characters in filenames #325
Comments
Git escapes paths by default, leading to the described behavior. You can disable this with |
Yes, thanks! Is it easy to fix it in forgit? If not, it may be usefull to add this workaround in the README. |
It does not appear to be a super easy fix, but seems doable. I'll leave this issue open and will take a closer look once I find the time if nobody beats me to it. You are of course also more than welcome to send in a PR to fix the issue, if you like to. git has a |
Looking further into this, I see the following options:
_forgit_git() {
git -c core.quotePath=false "$@"
} and replace all git calls with the function. This would also allow to quickly configure other git behavior for all functions, but is tedious. old_quote=$(git config core.quotePath)
git config core.quotePath false
_forgit_"${cmd}" "$@"
git config core.quotePath "$old_quote" This is a bit ugly, but should work reliably and is the smallest change.
I think I would prefer option 1. Would be interested in other peoples ideas/preferred approach. Any suggestions @carlfriedrich @cjappl? |
Thanks for digging into this @sandr01d. Solution 2 definitely seems ugly. I haven't understood, yet, why this happens in forgit but not with git directly. Where is the difference? We're calling git as well, so why does it behave differently? |
When core.quotePath is set to unset or true, git escapes "unusual" file names in its output, but does not expect to receive quoted file names as input. The issue then arises when we consume quoted file nams from git and feed it back into other git commands, as we do in |
I see, thanks for the explanation. That makes sense and should definitely go into a comment for why we are doing this. And in this case I would also prefer option 1. |
This permits tools like Neogit to play nice with special characters in files. See wfxr/forgit#325 (comment)
Check list
Environment info
Problem / Steps to reproduce
Git add with
ga
does not workAdd the file manually and commit:
Try to view log with
glo
, it works. Then press "enter" in this commit, it show empty screen for the file "my_fil\303\251".The text was updated successfully, but these errors were encountered: