-
Notifications
You must be signed in to change notification settings - Fork 59
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
Can't use wslgit.exe with SmartGit 18 #37
Comments
It looks like the backslashes are removed/escaped somewhere in the process of running the command in WSL. Can you try to set the (Windows) environment variable Thinking about it, the reason might be that relative paths with backslashes are passed. Currently, only absolute paths in the arguments are translated from the Windows representation to their Unix representation inside WSL. This is enough for VS Code or the command line, where either absolute paths are used, or you can specify relative paths with forward slashes. I'm not sure if you could configure SmartGit to, e.g., pass absolute paths. |
Tried the env var, didn't change anything. Also tried to find away to use absolute paths in SmartGit, can't find a way to configure that. Will reach to SmartGit support and see what can be done about that. |
Ok. The other solution, of course, is adding support for relative paths to wslgit. It came up a few times already, but I haven't found the time/need to implement it properly. To support relative paths, we would need to check every argument (with a backslash in it) if it is actually a file relative to the current working directory. However, this doesn't work with non-existing files, e.g. |
@andy-5 I reached to SmartGit about this and it went like this:
Not sure what could be the best course of action here... Of course none of this would be needed if SmartGit added proper WSL support like VS Code does in some places. Until then, I have to resort to solutions like It does work nicely on the command line. I even configured GPG signing inside WSL and |
Well, too bad, but I get their point. As I said, support for relative paths could be added, but it wouldn't work with non-existing files. I'll leave this issue open for now, maybe I, or someone else, finds some time to work on it. |
I've just added support for relative paths to A test build with this feature is available here. Can you please test with this binary and report back if the integration with SmartGit now works? |
@andy-5 I've been on vacation, give me a couple of days to test this and I'll report back as soon as I can. Thanks. |
@andy-5 It almost worked, but now I don't think you can do anything about it... SmartGit is using temporary files created on the host system and path translation between Windows/WSL is not working properly. But now the ball is on their court... P.S: The test build is again flagged "unsafe" as before. Feel free to close this issue if there's nothing else for us to discuss. I'll email SmartGit about this. Thanks for your support. |
Interesting, I didn't know about the |
There is a new test build available which now also translates paths inside arguments like This should hopefully fix the issue above and allow you to commit using SmartGit. Regarding |
@andy-5 @rfgamaral the commit works with the test build. But now the push does not. Here is the command invoked for push:
The command hangs indefinitely EDIT: after setting |
Thanks for the update. At least some progress, but the cmd script credential helper will not work inside WSL and I'm not sure I can do anything about it. Setting Does a manual push using wslgit work? You could test the exact command from SmartGit (minus the
If both of these do not work, or require user interaction to enter username/password, you probably need to configure credentials for git inside WSL, independent of SmartGit. For example by setting up a SSH key which is allowed to push to your repository. |
Hey guys, latest version v0.8.0 seems to have fixed all the problems for me, As soon as possible I'm going to test running npm scripts invoked by Git hooks and report back. If those work (I hope so and I believe they will), we can close this issue; unless someone else still has a problem. |
The Git hooks seem to be working for me. Although I still have a tiny issue with them, which I'll be able to fix with v0.9.0 (due to It didn't fix all the problems with Smartagit though... Trying to stage deleted files doesn't work. However, I'm also using |
It looks like the space in the credential.helper path is not properly escaped. I guess this is due to the switch to |
The space should be ok, but the regexes is not considering double-quote character as invalid in a windows path, which it should. Unix filenames can have |
Great, thanks @carlolars. I've merged your PR, and there is now a new alpha build for testing. @rfgamaral The PR automatically closed this issue. If there is still a problem, feel free to reopen it. |
Oops I wrote the magic word fixes in the PR... Didn't mean to close this issue. |
Sorry guys, this doesn't seem to have fixed the issue: Can you please reopen it? I don't have permissions for doing it... |
But we're getting closer :)
The quoting was deliberate, but maybe it is not required? (The usage example for Line 26 in 3dd36bd
The quoting is also present when transating unix-windows: Line 88 in 3dd36bd
|
The quotes for the wslpath argument should be there, but there is an issue with them described in #91. But that issue won't solve this issue entirely. The problem is the argument |
I just read about
SmartGit no longer adds |
This was not quite correct, cmd.exe escapes backslashes but for wslpath they are just several consecutive backslashes which wslpath merges into just one. But the main problem is still the same; the backslash when escaping the characters are used as actual backslashes. Is it working if using Git-For-Windows? @rfgamaral How did you make SmartGit use the credential.helper? I downloaded the lastest portable version of SmartGit and it does not add the credential.helper and I don't have it configured elsewhere. |
I didn't do anything, it was there by default for me... And I can't find a setting (inside SmartGit) anywhere to disable it. Not sure where it's coming from to be honest. All I found was this: https://www.syntevo.com/doc/display/SG/Using+the+Git+credentials+manager But |
Ignoring the credential manager issue for now, I believe all my SmartGit issues have been fixed with Environment variables:
~/.bashrc (inside WSL, only file sourced): if [ "${WSLGIT}" -eq "1" ]; then
if [ -d "$HOME/.node/bin" ]; then
export PATH="$HOME/.node/bin:$PATH"
fi
return;
fi SmartGit Hooks Example: Good job @andy-5 and @carlolars, thank you so much 🙇 |
There's still one small issue with the latest wslgit version (0.9.0) and SmartGit. Basically, when trying to stage a deleted file I get the following error: However, using the same Do you think this can be fixed somehow? P.S: I'm already used to build |
What a coincidence, yesterday I was thinking that it might be a good idea to at least document in an issue the problem with relative paths to files that don't exist on the filesystem. See #96 😄 The problems are that wslgit treats each argument separately with no knowledge about which git command it belongs to and therefore don't know what to expect, and it's approach to git arguments is "if it looks like a path then it is a path". |
Hum, interesting, will follow that issue :) I'm wondering if there's any change with SmartGit 19, I haven't upgrade myself yet... EDIT: Just download SmartGit 19 portable version for testing and the problem wasn't solved, in other words, SmartGit 19 still uses relative paths. Maybe I could ask SmartGit devs to change relative paths to absolute (unless they have some limitation on their side for doing it relative). |
I'm using SmartGit on Windows 10 and I can't get
wslgit.exe
working with this application. I get this error:Any idea why this is happening? It works on the command line:
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: