Closed gabyx closed 5 years ago
So the problem here is that the user in Git Bash is different than in WSL? That sounds like a general configuration issue, not specific to Githooks. I'm not against adding an extra flag to the install script, it's just cumbersome and one more flag to confuse users.
If githooks would know the installation directory (extract from alias), using githooks from bash in the subsystem behaves identically as on windows git-bash.exe.
That sounds like relying on a side effect. If we do this, we should set a global configuration value that points to the install dir (which I thought we have already), and use that. Is the problem here that the global Git config file will be a different one? If yes, do you have to set up all your Git config twice? Like committer name, email, etc.
Yes the config files need to be setup also in WSL under root/.gitconfig
If I wanna use the same alias.hooks
path, it wont work properly since the install directory is different in the subsystem and windows install...
If we do this, we should set a global configuration value that points to the install dir (which I thought we have already)
Where is this variable? We dont have this, I made once some changes in this direction, but during review we dropped this...
I would make a PR with a setting
[githooks]
installDir = "...."
and --prefix
for the installation.
Would that be of value?
We can talk about it.
Is the problem here not that the ~/.gitconfig
file will be different?
Because in that case we can't really set a config value for both places.
Jeah, but when I manually copy the gitconfig to the subsystem location /root/.gitconfig
-> I can manually replace the installDir = C:/User/..../.githooks
to something installDir = /mnt/c/Users/..../.githooks
and it should work :)
of course the templateDir
and alias.hooks
needs replacements too... That is the users part of course... has nothing to do with githooks.
Right... Not exactly good UX. :) If you have manual steps, you could just replace bits manually too.
Is the problem that we don't have anything in the global config about where Githooks is? What functionality needs the install directory by the way?
;-)
Is the problem that we don't have anything in the global config about where Githooks is?
Correct, thats the thing, githooks uses lots of hardcoded ~/...
paths which is not exactly what should be done when we would have a global install directory.
All it needs is
install.sh --prefix <path>
where the .githooks
folder gets installed~
is correct. ;)
The Git Bash / WSL setup sounds like not super compatible, nothing really specific to Githooks.
If that's all that's missing for you, then yeah please open a PR then we'll get it in. :+1:
Jeah I think thats all thats missing. :-) I will have a look when I have time. thanks :-)
Great, thank you!
~ is correct. Of course, I would also leave this as the default install directory :-).
It would be really nice to take up again the install folder again, since it would make usage of the following scenario much easier, as well as it is more powerful:
When I install githooks on Windows it will be installed to
C:/Users/.../.githooks
. The git config ins Ubuntu Subsystem/root/.gitconfig
would then look something like:When you wanna do some git manipulation in windows ubuntu subystem. You end up reinstalling shared hooks somewhere else
/root/.githooks/...
. This is quite cumbersome. If githooks would know the installation directory (extract from alias), using githooks from bash in the subsystem behaves identically as on windows git-bash.exe.It would be nice, to have the already proposed
set_install_dir
in place and replace all occurances~/.githooks
with a proper install dir. and also provide a--prefix
option ininstall.sh
.