You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
For some hooks (for example commit-msg), git will call the hook with the path to the file containing the commit message (almost always .git/COMMIT_EDITMSG). From man githooks:
commit-msg
This hook is invoked by git commit, and can be bypassed with the --no-verify option.
It takes a single parameter, the name of the file that holds the proposed commit log message.
However, the hooks4git wrappers discard these parameters:
$ cat .git/hooks/commit-msg
#!/bin/bash
if [ -x "$(command -v hooks4git)" ]; then
hooks4git -t $(basename $0)
fi
Is there a reason that hooks4git cannot pass these parameters on to the hooks? I tried adding "$@" to the end of the hooks4git command but that obviously didn't work out of the box :)
Thanks!
The text was updated successfully, but these errors were encountered:
Well, the $(basename $0) is just to get the name of the hook being triggered, so I can forward that information to inside H4G.
$0 is the calling script name inside your project .git hooks folder.
Not sure if I fully got it, but can you explain what are you trying to get solved? This piece of code does what it needs to do.
The git operation happens, a hook is called, I intercept that and propagate that into hooks4git logic, it runs the analysis, and provides a 0 or 1 back to git caller executable. Then, and only then, git workflow actually finalizes, outside hooks4git logic.
Hi!
For some hooks (for example commit-msg), git will call the hook with the path to the file containing the commit message (almost always
.git/COMMIT_EDITMSG
). Fromman githooks
:However, the hooks4git wrappers discard these parameters:
Is there a reason that hooks4git cannot pass these parameters on to the hooks? I tried adding
"$@"
to the end of the hooks4git command but that obviously didn't work out of the box :)Thanks!
The text was updated successfully, but these errors were encountered: