-
-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Description
This might be intended behavior, but I'd like to get confirmation.
Since 4.1.0
, meta-hook check-hooks-apply
marks forbid-new-submodules
as "does not apply", if the repo does not contain any submodules.
The hook forbid-new-submodules
itself correctly warns when adding submodules to a previously empty repo, so it technically does apply.
This might have to do with the changes introduced in #619.
Steps to reproduce:
- Create new repo
$ git init issue-707 && cd issue-707
- Create
.pre-commit-config.yaml
with following content:repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.1.0 hooks: - id: forbid-new-submodules - repo: meta hooks: - id: check-hooks-apply
- Commit
.pre-commit-config.yaml
$ git add .pre-commit-config.yaml && git commit -m "Add pre-commit config"
- Run the following:
$ pre-commit run --all forbid new submodules................................(no files to check)Skipped Check hooks apply to the repository......................................Failed - hook id: check-hooks-apply - exit code: 1 forbid-new-submodules does not apply to this repository
- Add submodule and force-commit
$ git submodule add https://github.com/pre-commit/pre-commit-hooks.git $ git commit -m "Add some submodule" -n
- Run the following:
$ pre-commit run --all forbid new submodules....................................................Passed Check hooks apply to the repository......................................Passed
Metadata
Metadata
Assignees
Labels
No labels