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.
When git status runs in a repo with submodules, it'll recursively run
git status in every submodule as well by default (sequentially).
git status is substantially slower on Windows than on Linux. git diff
behaves similarly to git status in terms of running recursively within
all submodules. In repos with hundreds of submodules, this quickly adds
up when git status/diff are called multiple times. Pre-commit runs
git status once at the beginning of an operation and then runs git diff
before and after each hook. These calls quickly add up and make
pre-commit unusable in large repos with lots of submodules.
This commit drastically improves performance in repos with lots of
submodules and fixes#1701 by telling git status and git diff to ignore
submodules. This change is not expected to have any negative effect on
existing hooks because each submodule should manage its own hooks
instead of relying on superproject hooks to manipulate their contents.
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