Skip to content

N-th git hook argument usage #597

Answered by mrexox
avudnez asked this question in Q&A
Dec 19, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hey! I think you have this error because you run lefthook explicitly via lefthook run commit-msg. {1} will be a commit message file only when running via git hook, so in your case this will work:

lefthook install
git commit -m 'check my message, python script'

But if you want to test this hook, you can do the following:

echo 'check my message, python script' > /tmp/commit-message
lefthook run commit-msg /tmp/commit-message

I've appended an argument /tmp/commit-message to the explicit call of lefthook. In that case everything must work as expected,

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@avudnez
Comment options

Answer selected by avudnez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants