-
-
Notifications
You must be signed in to change notification settings - Fork 100
Fix tests and execution on Windows #20
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
Conversation
69e760f to
d8f41d0
Compare
arxanas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waych Thanks for working on this! One question, would you be able to get Github Actions to run CI for Windows as well? I'm almost certain to break the Windows build later if I don't have something to test on...
This way the test can pass on Windows as well
This seems to show up in Window git.exe output.
Replace guessing at paths for `true` when setting GIT_EDITOR and use ':' instead. ':' is normally an equivalent to `true`, and git treats GIT_EDITOR=":" especially to skip the editor invocation (see strcmp() against ":" in `git/editor.c:launch_specified_editor()`. Using it allows us to remove the dependency on `true`, making this code simpler and portable to Windows.
In tests, when the "system git" is desired, PATH_TO_GIT is ignored and a hardcoded path to the system git is used (typically /usr/bin/git). "system git" is only used in two places, and it is unclear how important those locations be handled by "system git" rather than "git under test", so just do the conservative thing and add a path to the default location of git.exe on Windows.
67d8a3b to
77d541d
Compare
To run correctly on Windows, all invocations of hooks need to be executed as an argument to bash. This changes the code to build commands using get_bash() with the `-c` flag. When discovering which bash to use, we are careful on Windows to pick "git-bash" aka the bash.exe that comes with git. This is neccesary as git-bash uses different path translations than regular bash.exe, and using the wrong one would result in git.exe not being able to discover the git-branchless.exe binary correctly (when invoked in hook). If the target_os isn't windows, `sh` is for executing hooks instead.
|
PTAL Rebased and addressed feedback. |
|
LGTM, thanks again! |
|
@waych Do you think there's anything else which should be done to say that it supports Windows? If not, I can tag a new release and announce support. |
|
@arxanas Can't think of anything else that needs to be done at this point other than updates to the changelog. 😃 |
This PR fixes various issues affecting execution of git-branchless commands and tests on Windows.
With these changes all tests pass and commands appear to work as intended.