I am trying to run a script with pre-commit hook. Here is my script:
build_script.sh
#! /bin/bash
echo "Stage 1: Preparing CMake configuration"
.pre-commit-config.yaml
fail_fast: false
- repo: local
hooks:
- id: Generate build
name: Generate build
entry: sh build_script.sh
language: system
always_run: true
pass_filenames: false
I can see when I run command git commit -m "message"
, the hook calls the script and Generate build
will Pass. However, I do not see the echo on the terminal. I would like to see the message, "Stage 1: Preparing CMake configuration"
. What is wrong with this setup?
CodePudding user response:
pre-commit takes a bit from unix philosophy here -- it is silent unless there is a problem (by default).
if your script fails then the output will be displayed
you can also use --verbose
to show the full output (for debugging) and optionally set verbose: true
on your hook itself. note: these are both debugging options and are not intended for use outside that -- we've found that when hooks are noisy contributors tend to ignore all of the output
disclaimer: I wrote pre-commit