A framework for managing and maintaining multi-language pre-commit hooks.
Find a file
Yuri D'Elia 037bc078dc Improve path canonicalization
The git toplevel is a path with all symlinks leading to the repository
root resolved. When transforming the supplied files to paths relative to
the repository's root we _also_ need to resolve all symlinks up to the
repository's root in order to correctly handle different symlinked paths
that eventually lead to the same repository.

Such paths are currently accepted by git, but are not matched correctly
in pre-commit, as they incorrectly show as out-of-tree.

To relativize paths correctly we iteratively try to replace the trailing
components of the absolute path until the repository root is matched.
The root prefix is then substituted for the real path, yelding a path
with the subtree path untouched. This allows to correctly supply a
symlink within the working tree to git itself.

For paths which are not directly given as an argument to git, using
os.path.realpath() instead is sufficient.

This allows pre-commit to see the subtree path in the same way as
currently accepted by git.
2021-10-28 11:39:24 +02:00
.github add a bug report issue form 2021-09-06 15:01:42 -04:00
pre_commit Improve path canonicalization 2021-10-28 11:39:24 +02:00
testing exit(main()) -> raise SystemExit(main()) pt2 2021-10-24 07:19:57 -07:00
tests Add fail_fast support per-hook 2021-10-22 19:16:30 -04:00
.gitignore add initial dotnet support 2020-09-27 15:04:35 -07:00
.pre-commit-config.yaml [pre-commit.ci] pre-commit autoupdate 2021-10-25 18:59:17 +00:00
.pre-commit-hooks.yaml fix casing in .pre-commit-hooks.yaml 2021-07-03 11:14:05 -07:00
azure-pipelines.yml add support for dart as a hook language 2021-08-29 08:57:56 -07:00
CHANGELOG.md v2.15.0 2021-09-02 20:33:19 -04:00
CONTRIBUTING.md Add foor missing required dependencies in CONTRIBUTING.md 2020-06-12 18:38:44 +02:00
LICENSE MIT 2014-06-05 08:57:40 -07:00
README.md Add pre-commit.ci 2020-10-26 16:11:27 -07:00
requirements-dev.txt make an exe stub for windows 2020-09-28 18:37:10 -07:00
setup.cfg ban broken importlib-resources versions 2021-10-19 19:02:36 -07:00
setup.py Migrate setup.py to setup.cfg declarative metadata 2019-02-27 22:12:03 -08:00
tox.ini add initial dotnet support 2020-09-27 15:04:35 -07:00

Build Status Azure DevOps coverage pre-commit.ci status

pre-commit

A framework for managing and maintaining multi-language pre-commit hooks.

For more information see: https://pre-commit.com/