mattmc3 / antidote

https://getantidote.github.io - the cure to slow zsh plugin management
MIT License
855 stars 21 forks source link

Fixes installation on git-bash #143

Closed marovira closed 11 months ago

marovira commented 1 year ago

This fully fixes the issue where the paths on git-bash are wrong. There are however a few things to review:

  1. The original solution breaks the tests because it adds a / to the start of the path and makes everything lower-case. Ignoring the lower-case issue, the underlying problem is that manually adding this would make it so $HOME becomes invalid in the tests. What I came up with is to construct the location of AppData directly using the $HOME variable itself. The thing is... I'm not entirely sure that this is always going to work (I don't have msys or cygwin so I can't confirm this) since the $HOME variable could very well point to something else. The issue with using LOCALAPPDATA directly is that git-bash does not convert from Windows to POSIX path on system variables, so the path would come out wrong. I'm not really sure what the best solution is, but I'm open to suggestions.
  2. I tried to hook in the Windows runner... with not a lot of success. As you can see it does run but: a. The shell doesn't switch to zsh for some reason b. The testing code relies on functions that do not exist on git-bash (mainly subenv). So even if the shell got switched, it wouldn't work because of the missing commands.

Bottom-line: I don't really know if there is a "best" solution here that would fully fix everything. We can kind of fudge the testing on Windows since the tests already verify all of the possible OS configurations, but it doesn't fully address the issue.

marovira commented 1 year ago

An alternative option that could work is if we added a note on the README explaining what needs to be changed? It would make updating antidote annoying since the user would have to go in and stash the change prior to updating, but maybe that's not a huge issue since git-bash is a more specific use case?

marovira commented 1 year ago

Good news! I have a better solution that will solve everything consistently. I completely forgot that msys and cygwin (git-bash gets this by extension) have a command called cygpath that converts windows paths to POSIX. This would fully solve the issue since it would be guaranteed to always work regardless of the environment. The only issue is that using cygpath will obviously break the tests on Linux/MacOS since that's a Windows only thing. I'm not really sure what you want to do here. The easiest solution is to remove the tests for cygwin/msys for getting the home directory, but I don't know if that's something you'd want to do.

marovira commented 1 year ago

Just to update: I managed to figure out a way to make a Windows runner switch to zsh successfully. The issue now is that git-bash has a very limited subset of bash commands, with some having restricted options. You can see the logs on the last attempt (see test-win) for details. At this point I honestly don't know what should be done. Given what I've done and tested, I can see three (not so great) options:

  1. If you wanted full coverage, there would be significant work that needs to be done to re-write the tests (or split them out for different platforms) so they run, and I'm not really sure it's worth the effort.
  2. Remove the test for msys from test_cmd_home.md. That will allow the tests to run but you'd be skipping one test case, which given how much setup is required to get it to run... seems like a fair trade-off.
  3. Add a note to the README that explains how to make Antidote work with git bash (and potentially msys, not really sure about cygwin).

It's ultimately up to you. We can also just nix the whole thing and just add a note to the original issue about how to solve it and then refer people to that.

mattmc3 commented 1 year ago

Thanks for the effort here. I have some time today to look and see where we can go from here.

mattmc3 commented 11 months ago

I appreciate the attempt. The work that went into the yaml CI workflows was a great start. In the meantime I found an old clunker running Windows I was able to test git-bash on, so I feel I can at least support it myself without proper CI for now. If we ever want to give this another go, we can reopen.