Running oc hook set will create the hook symlink file prepare-commit-msg at "root".
I'm running at oc version 1.1.39 and dev branch.
Expected Behavior
The hook symlink file should be created in the current git repo hook directory.
Current Behavior
Running oc hook set will create the hook symlink file prepare-commit-msg at C:\.git\hooks\prepare-commit-msg.
This can also be seen in the log output. Though it looks fine because the hook file is created, but it is created in the wrong place.
From what I could tell from the code, it's because there is a path separator at the start of SYMLINK_URL. So when creating the symlink, it creates \.git\hooks\prepare-commit-msg instead of .git\hooks\prepare-commit-msg.
Possible Solution
Remove the separator variable, because path.join already ensures the correct path separator is used.
I already tested this with the separator variable removed, npm run dev --hook set worked as expected, prepare-commit-msg is created at .git\hooks, and git commit also calls the hook.
Steps to Reproduce
Run oc hook set.
Relevant log output
β setting opencommit as 'prepare-commit-msg' hook at \.git\hooks\prepare-commit-msg
β
β β Hook set
Opencommit Version
1.1.39
Node Version
v18.13.0
NPM Version
9.6.3
What OS are you seeing the problem on?
Windows
What happened?
Running
oc hook set
will create the hook symlink fileprepare-commit-msg
at "root". I'm running at oc version 1.1.39 and dev branch.Expected Behavior
The hook symlink file should be created in the current git repo hook directory.
Current Behavior
Running
oc hook set
will create the hook symlink fileprepare-commit-msg
atC:\.git\hooks\prepare-commit-msg
.This can also be seen in the log output. Though it looks fine because the hook file is created, but it is created in the wrong place.
From what I could tell from the code, it's because there is a path separator at the start of
SYMLINK_URL
. So when creating the symlink, it creates\.git\hooks\prepare-commit-msg
instead of.git\hooks\prepare-commit-msg
.Possible Solution
Remove the separator variable, because
path.join
already ensures the correct path separator is used. I already tested this with the separator variable removed,npm run dev --hook set
worked as expected,prepare-commit-msg
is created at.git\hooks
, andgit commit
also calls the hook.Steps to Reproduce
Run
oc hook set
.Relevant log output