Skip to content
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

hooks work but the git commit command doesn't commit #1335

Closed
martiliones opened this issue Jan 25, 2024 · 10 comments · Fixed by #1336
Closed

hooks work but the git commit command doesn't commit #1335

martiliones opened this issue Jan 25, 2024 · 10 comments · Fixed by #1336

Comments

@martiliones
Copy link

martiliones commented Jan 25, 2024

Minimal Reproduction:

# Cloning test repository
$ git clone https://github.com/martiliones/husky-bug
$ cd husky-bug

# Installing husky
$ npm i

# Making changes into the test project
$ echo "some changes" > newfile.txt
$ git add .

# Commiting the changes and confirming hooks are working
$ git commit -m "some changes"
git hooks are running

# The command above didn't commit anything
$ git push origin master
Everything up-to-date
@vanduong185
Copy link

I got same issue

@vanduong185
Copy link

I did downgrade to v8.0.3 then It worked fine.

@martiliones martiliones changed the title hooks work but the commit command doesn't commit hooks work but the git commit command doesn't commit Jan 25, 2024
@cilly-yllic
Copy link

I did HOSKY=0 git commit -m 'comment'. It will skip git hook commands, but allows commits, so I think I'll use this workaround until it is fixed.

@remarkablemark
Copy link

I am also getting the error where I run git commit but the Vim editor does not show up

@recallwei
Copy link

I face the same problem.

@IronGeek
Copy link

IronGeek commented Jan 25, 2024

Having the same issues.

I think it fails because the exit code in husky.sh is literally hardcoded to 1

husky/husky.sh

Lines 15 to 20 in 513c2c9

sh -e "$s" "$@"
c=$?
[ $c != 0 ] && echo "husky - $h script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
exit 1

Souldn't it be exit $c instead?


Update:

I edited my local .husky/_/h file and the changed the last line to exit $c. It seems the git commit command works again.

[ $c != 0 ] && echo "husky - $h script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
- exit 1
+ exit $c

@lunoob
Copy link

lunoob commented Jan 25, 2024

The same problem appears when using it with release-it

@talhaibnmahmud
Copy link

Having the same issues.

I think it fails because the exit code in husky.sh is literally hardcoded to 1

husky/husky.sh

Lines 15 to 20 in 513c2c9

sh -e "$s" "$@"
c=$?
[ $c != 0 ] && echo "husky - $h script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
exit 1

Souldn't it be exit $c instead?

Update:

I edited my local .husky/_/h file and the changed the last line to exit $c. It seems the git commit command works again.

[ $c != 0 ] && echo "husky - $h script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
- exit 1
+ exit $c

This fixed the issue for me too. This should be fixed with the new release ASAP

B4nan added a commit to mikro-orm/mikro-orm that referenced this issue Jan 25, 2024
Breaks the dev builds probably because of typicode/husky#1335
@gergelypap
Copy link
Contributor

Fix available at #1336

Thanks @IronGeek for spotting it out!

@ffMathy
Copy link

ffMathy commented Jan 25, 2024

Great work on getting it fixed! Husky is fully operational now ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants