Clone this repo into .git/hooks to use the hooks defined in this repository.
The hook commit-msg calls the shell script scripts/commit-msg-hook and
passes the commit message as the first command line argument.
The shell script returns 0 if the commit message is valid and 1 otherwise.
You must use Java (version 21) to implement the commit message validation.
You might have to update the path to the Java binary in the shell script.
For the submission, you are expected to use the single file source code approach as suggested
(see JEP 330).
To ease debugging, you can create a separate file CommitMsgHook.java and use the input strings from the
test cases in ./scripts/commit-msg-hook-test to test your program. Example:
cd ./scripts
java CommitMsgHook.java $(printf "feat: short description\n\nadditional details in body")You can use the tests cases to check your implementation. To do that, you have to install Bats Core first and potentially update the path to the binary. Don't worry if not all tests pass; you should nevertheless submit your code. We will consider the complexity of the specification during the grading.
cd ./scripts
./commit-msg-hook-test