-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
PATH's different names in Windows and Linux causing git-branchless hook execution to fail #1256
Comments
Since #370 is marked as |
After restoring my hooks to their original state (without the full path workaround I had been using), I deleted my local Path variable and added PATH and re-ran one of my failing test cases. The hook git branchless was able to find git correctly and everything seemed to work. Nice find, C00t! Is someone who has git-branchless set up for development able to make a PR for this? I guess I could... but I'd have to figure out how to get Rust set up for development again. |
@AaronLieberman I've done a quick fix in my fork, and if you use cargo you can install it using below command. But I'm not sure if this fix is correct (i.e., only modifying the implementation of the cargo install --git https://github.com/c00t/git-branchless -f |
A workaround for this bug is to create and execute a file @echo off
set OLDPATH=%PATH%
set PATH=
set PATH=%OLDPATH%
set OLDPATH= |
@arxanas @c00t's fix works for me. I tested it locally based on that branch and it's working for me on Windows as well on Ubuntu on WSL2. It looks like quite a safe change as from the code it looks like it wouldn't affect non-Windows platforms. Having this in the mainline would be a big improvement so that Windows would work reliably. Would you be able to merge it into mainline? I tried to open up a PR for it but I'm not in the contributors group so it wouldn't let me. This change fixes issues #1256, #370, and #1144. |
@c00t can you open a PR, or a otherwise affirmatively state that your code is fine to merge under the git-branchless license? |
I do a lot of game engine programming so i can't avoid using git under native windows. When using git-branchless, I also had similar problem as (#370 , #1144 ). Begin debugging...
In #370
No, This is not a Git for Windows problem, after I debugged it, I realized that it is due to the naming of the
Path
environment variable, in the following code,git-branchless
reads the environment variable namedPATH
, but in windows, the variable name should bePath
.git-branchless/git-branchless-lib/src/git/run.rs
Lines 407 to 422 in e7c3653
I believe this is due to the fact that the windows shell is insensitive to the case of environment variable names (both pwsh and cmd), which many developers don't pay attention to on windows, you can read the environment variables correctly in the shell with
Path
PATH
or evenPaTh
.quick fix:
yep, windows target's
std
crate also:Originally posted by @c00t in #370 (comment)
The text was updated successfully, but these errors were encountered: