in the following setup
├── common
│ ├── .pre-commit-config.yaml
│ ├── script1.sh
│ └── script-config
├── repo1
│ └── code_file
└── repo2
└── code_file
a common configuration from 'common' folder will be installed using an
absolute path to repo1 and repo2.
As local tools needs to be run (script1.sh with its
configuration script-config) we need to pass the path to common
somehow into the hook cmdline.
Add support for a template variable %CONFIG_BASEPATH% which
is automatically expanded to the configuration directory when
pre-commit run is called
This helps to create a single source of truth setup, while still
keeping the possibility to call non public tools and configurations
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
From the `pre-push.sample` file:
> Information about the commits which are being pushed is supplied as
> lines to the standard input in the form:
>
> <local ref> <local sha1> <remote ref> <remote sha1>
When `<local ref>` is not simply a branch name, but a more general
ref (see git-rev-parse(1)), it could contain whitespace, and that
breaks the split() call that expected only 3 spaces in the line.
Changed to use `rsplit(maxsplit=3)` since only the <local ref> is
likely to have embedded whitespace.
Added a new test case for the same.
Add a `--no-allow-missing-config` option to the `init-templatedir`
command. Enable configuration of a Git template that requires newly
cloned repos to have a `pre-commit` config.
If rev is wrapped in single or double quotes (e.g. due to a yamllint quoted-strings rule), when
re-writing the rev to update it, honour the existing quotation style
If using the prepare-commit-msg and commit-msg stages specifically (such
as with the try-repo command), the `--commit-msg-filename` arg must be
provided.
[fixes#1336]
chore: improve error message for hook stage check