-
Notifications
You must be signed in to change notification settings - Fork 348
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
Feature: Work with husky #47
Comments
di-sukharev
pushed a commit
that referenced
this issue
Apr 1, 2023
* refactor(cli.ts): call isHookCalled function asynchronously feat(githook.ts): add support for git core hooks path and fallback to default symlink url if not found feat(utils/git.ts): add getCoreHooksPath function to retrieve the path of the core hooks directory. * refactor(githook.ts): remove console.log statement from hookCommand function * feat(prepare-commit-msg-hook.ts): add isStageAllFlag parameter to prepareCommitMessageHook function to stage all changes if flag is true * refactor(githook.ts): use path.join to join path segments instead of string concatenation style(githook.ts): format code with prettier
zen0bit
pushed a commit
to oSoWoSo/opencommit
that referenced
this issue
Apr 12, 2023
* refactor(cli.ts): call isHookCalled function asynchronously feat(githook.ts): add support for git core hooks path and fallback to default symlink url if not found feat(utils/git.ts): add getCoreHooksPath function to retrieve the path of the core hooks directory. * refactor(githook.ts): remove console.log statement from hookCommand function * feat(prepare-commit-msg-hook.ts): add isStageAllFlag parameter to prepareCommitMessageHook function to stage all changes if flag is true * refactor(githook.ts): use path.join to join path segments instead of string concatenation style(githook.ts): format code with prettier
zen0bit
pushed a commit
to oSoWoSo/opencommit
that referenced
this issue
Apr 14, 2023
* refactor(cli.ts): call isHookCalled function asynchronously feat(githook.ts): add support for git core hooks path and fallback to default symlink url if not found feat(utils/git.ts): add getCoreHooksPath function to retrieve the path of the core hooks directory. * refactor(githook.ts): remove console.log statement from hookCommand function * feat(prepare-commit-msg-hook.ts): add isStageAllFlag parameter to prepareCommitMessageHook function to stage all changes if flag is true * refactor(githook.ts): use path.join to join path segments instead of string concatenation style(githook.ts): format code with prettier
Stale issue message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem:
Opencommit only works with git hooks.
Solution:
Refactor the code to add some dynamic logic to the tool
Explanation:
Identify hooks' path in the repo you are working in. This can be accomplished with the following command:
git config core.hooksPath
This needed to be translated into a util function for git so I wrote the following function:
Note: the function throws an error when there is no set path that needs to be caught when used.
Determine the path by invoking
getCoreHooksPath
catch the error and give theDEFAULT_SYMLINK_URL
ifcore.hooksPath
is not set.Refactor our two helper functions to utilize the
getHooksPath
function.Replace the variable calls
isHookCalled
andisHookExists
with the function callawait isHookCalled()
andawait isHookExists()
respectively.Scenarios Tested
When core.hooksPath is not set
When core.hooksPath is set to .husky
The text was updated successfully, but these errors were encountered: