-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix(git): Use absolute path instead #264
fix(git): Use absolute path instead #264
Conversation
b2a2cb8
to
c6e3ecf
Compare
subcommands/git/cmd.go
Outdated
} | ||
|
||
helperName = subcommands.EncodeWhiteSpace(helperName) |
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.
I'm now confused by this whole PR. I think the normal case (not windows i guess) is to:
- find a directory in
$PATH
we can write to - link file fioctl -> git-credential-fio
- run
git config ...
to set the helper
The whole point of finding something in $PATH is so we don't need absolute paths?
It almost sounds like on windows - we aren't finding something in the user's actual path?
If we do need absolute paths, rather than trying to "encode" (nitpick - I think we are escaping) - we probably need to put quotes around what we present to git-config. That way what winds up in git config looks like:
helper = "c:\\program files\blah.exe"
I suspect the quotations would address things beyond spaces we haven't considered.
That said - seems like the bug is that we can't find PATH correctly on windows
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.
I agree, the problem partly stems from us requiring the user to run as root
/Administrator
and the PATHS
being different for them on Windows. I will briefly look into a way if you can easily get the original calling user on Windows. If that is the case we could either add in logic to add things to the PATH for that user, or place the symlink into one of the places in their PATH locations. Then we can drop this special case for Windows again, apart from the naming having an extra .exe
. 👍
Signed-off-by: Eric Bode <[email protected]>
c6e3ecf
to
e9a8568
Compare
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.
LGTM
I'm fine to merge this as long as @doanac is fine with it.
Signed-off-by: Eric Bode <[email protected]>
Signed-off-by: Eric Bode <[email protected]>
Installing
git
on Windows will most likely place it in theProgram Files
directory.Following our own docs on Windows will run the command as Administrator and place the resulting credential helper in
C:\Program Files\Git\bin\
. In order to make it work as seamless as possible on Windows we use the absolute path configuration for the credential helper in the.gitconfig
file managing the global configuration for git.On Windows the absolute path has to be converted into a different format.
\
have to become/
\\
This works around symlinks, permission errors and other edge cases on Windows.