I'm trying to setup git hooks via moon on windows under GIT bash.
The issue is that under GIT bash, moon sync hooks will deploy under .git/hooks/pre-commit, a hook that is calling the .\.moon\hooks\pre-commit.ps1 (powershell) file instead of .\.moon\hooks\pre-commit (bash):
error:
pre-commit : The term 'pre-commit' is not recognized as the name of cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:........moon\hooks\pre-commit.ps1:7 char:1
Expected behavior
Under windows & GIT bash, when syncing hooks, the hook that should be used is the bash one instead of the powershell one.
Screenshots
Environment
moon --version
moon 1.23.1
Additional context
Here also the file pre-commit.ps1 generated
#!/usr/bin/env powershell
$ErrorActionPreference = 'Stop'
# Automatically generate by moon. DO NOT MODIFY!
# https://moonrepo.dev/docs/guides/vsc-hooks
pre-commit run
EDIT:
I think I misunderstood how it work. I didn't notice that the file generated by moon sync hooks was based on the vcs.hooks. commands.
But the issue remains the same, the sync generate the ps1 that is called from git hooks. But as I'm using GIT bash, it'd be better to generate the bash version of the hook and not the ps1.
Describe the bug
I'm trying to setup git hooks via moon on windows under GIT bash. The issue is that under GIT bash,
moon sync hooks
will deploy under.git/hooks/pre-commit
, a hook that is calling the.\.moon\hooks\pre-commit.ps1
(powershell) file instead of.\.moon\hooks\pre-commit
(bash):Steps to reproduce
Create your hook under
.moon/hooks/pre-commit
.Add the hook config under
.moon/workspace.yml
Run
moon sync hooks
under GIT bashAdd and commit `git commit -am "test"
error
: pre-commit : The term 'pre-commit' is not recognized as the name of cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:........moon\hooks\pre-commit.ps1:7 char:1Expected behavior Under windows & GIT bash, when syncing hooks, the hook that should be used is the bash one instead of the powershell one.
Screenshots
Environment
Additional context Here also the file
pre-commit.ps1
generatedEDIT: I think I misunderstood how it work. I didn't notice that the file generated by commands.
But the issue remains the same, the sync generate the ps1 that is called from git hooks. But as I'm using GIT bash, it'd be better to generate the bash version of the hook and not the ps1.
moon sync hooks
was based on the vcs.hooks.