-
Notifications
You must be signed in to change notification settings - Fork 29
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
Windows wrapper #10
Windows wrapper #10
Conversation
On Windows, I was having a problem with Git Bash's case builtin not matching "INITREMOTE\r\n" against "INITREMOTE". This should fix that by stripping off CRLFs (and all whitespace) at the end of a command.
It's written in C# and basically makes it so that when git annex tries to createProcess on "git-annex-remote-rclone" it works.
The script now properly runs on Windows, through a wrapper I will PR separately. To make this work, I've had to not strip backslashes from the input (by adding -r to the read calls). They are being specified as path separators, and stripping them screws up paths. I also swapped out the right-trim for a more specific remove-trailing-CR-if-present, which is now uniformly applied to both instances of read. I also left in my check for trying to upload a nonexistent file (which happened when backslashes were stripped). It *should* never happen, but it's definitely an error if it does.
Thank you for this as well as your other pull request. I'd like to merge Windows support. I'm not an active Windows user these days, so it's a little harder for me to support properly. In terms of handling builds/releases:
In terms of the code itself:
In any event, I'm pretty sure that simply assuming that it's only a 32-bit machine and program files is on C: is incorrect. https://git-annex.branchable.com/install/Windows/ talks about the need for using 32-bit binaries, so that part of things may be correct. It might also be appropriate to check both the location where a 64 bit binary would be expected as well as where a 32 bit binary would be expected. |
@joeyh It just occurred to me that rather than have git-annex launch a wrapper for bash which launches this wrapper for rclone, perhaps when git-annex launches a remote on Windows it could pay attention to the shebang and launch this remote using bash without the use of the wrapper contributed by @interfect . But perhaps that adds unnecessary work for you or is a bad idea for some other reason I haven't considered. |
Getting Git Annex itself to try and interpret shebangs might sort of solve It does make sense to check the Windows environment variables, and maybe Those binary files can probably be dropped from the PR. I will see about This EXE is actually done in C#, which runs on .NET, so one should be On Thu, Sep 1, 2016 at 7:34 AM, Daniel Dent notifications@github.com
|
Oh, git-annex already deals with this particular windows nonsense elsewhere. When it needs to run a git hook, it parses it for a shebang. Git for windows does the same. So, if you can please open a todo item in git-annex, I can refactor that existing code to be used in more places. |
@joeyh As usual, you are awesome :). I've opened http://git-annex.branchable.com/todo/refactor_shebang_handling_code_for_wider_use/ @interfect Joey's proposal seems like the most elegant approach here. If for some reason that doesn't work out, your Mono suggestion seems sensible |
I'm going to close this, then, and wait on that change to git-annex itself. |
Done, please test the git-annex change.. |
Hm... so I gave this a shot with the most recent version of I moved both However, trying to enable the remote still yields:
Is there anything obvious that I may be doing wrong? |
On top of #9, adds an .exe file that just runs the shell script in the same directory under Git Bash. Needed because Git Annex can't invoke the shell script as an executable on Windows.
I'm using this and it appears to be working for me, against an Amazxon Cloud Drive rclone remote.