Zander Hill
ff66c20c6e
Fix types bug by using FrozenSet#intersection
...
Fixes a bug where files are not being recognized based on their `types`
using configuration file.
In the case of using `types: ['bash', 'sh', 'shell']` in
pre-commit-config, those filetypes will not be found, resulting in "no
files found" being reported with pre-commit. This persists even when
using --all-files flag.
Intersection produces predictable results in Python 2.7 and 3.x.
2018-05-03 12:19:57 +01:00
Zander Hill
29d66f470d
Add tests for _filter_by_types
...
Adds a test for python and bash `types` using identify per interpreter
interpretation.
The python test succeeds with a false positive. The bash test identifies
the bug, where a comparison happens between `tags >= types`.
Tags is the tag list from identify, types is the value passed in from
configuration file as `acceptable types`.
The `tags(List) >= types(FrozenSet)` does a sort comparison of the two sequences
as evidenced by this code sample (which should return True):
```
>>> types = frozenset(['a'])
>>> tags = ['bash']
>>> tags >= types
True
```
Note: In 2.7, I cannot get this to return anything other than True.
Including the empty case:
```
>>> [] > frozenset()
True
```
Which means to me that a list is always >= a frozenset in Python 2.7.
In Python 3.5, I see errors when comparing a List to a FrozenSet. So
thankfully the interpreter is stricter in this case.
```
>>> [] >= frozenset()
TypeError: unorderable types: list() >= frozenset()
```
2018-05-03 11:46:07 +01:00
Anthony Sottile
e55f51fb14
Remove unused __popen DI
2018-05-02 11:25:16 -04:00
Anthony Sottile
af93bec4fd
Fix regression: try-repo from relative path
2018-03-17 20:02:06 -07:00
Anthony Sottile
96e9d1b758
Restore git 1.8 support
2018-03-12 14:36:07 -07:00
Anthony Sottile
65f001b007
Fix go 1.10: no pkg dir
2018-03-12 14:02:34 -07:00
Anthony Sottile
c6b6d2340e
Merge pull request #716 from tdeo/multiline_pygrep
...
Add multiline mode to pygrep
2018-03-09 09:39:09 -08:00
Thierry Deo
55ef3ce960
Address review comments
2018-03-09 09:22:34 +01:00
Thierry Deo
55c74c10d9
Rename option to and improve output
2018-03-08 09:42:32 +01:00
Anthony Sottile
bf5792eb10
Add a manual stage for cli-only interaction
2018-03-07 12:41:25 -08:00
Thierry Deo
19075371fa
Pre-commit compliance
2018-03-07 09:35:08 +01:00
Thierry Deo
25c06e6525
Remove encoding dependence
2018-03-07 09:24:56 +01:00
Anthony Sottile
f679983012
Refuse to install with core.hooksPath set
2018-03-03 15:24:14 -08:00
Anthony Sottile
2722e16fd8
Use --clean-src for nodeenv
2018-03-01 14:06:48 -08:00
Thierry Deo
3793bc32c0
Fix linters
2018-02-26 15:46:33 +01:00
Thierry Deo
2d57068f49
Remove newlines from file contents
2018-02-26 13:29:40 +01:00
Thierry Deo
69333fa227
Add multiline mode to pygrep
2018-02-26 10:17:21 +01:00
Anthony Sottile
5651c66995
Migrate sha -> rev
2018-02-24 20:19:39 -08:00
Anthony Sottile
184e22e81f
Merge pull request #714 from pre-commit/remove_cwd_fn
...
Move cwd() to tests-only
2018-02-24 17:44:45 -08:00
Anthony Sottile
86da772fd2
Merge pull request #713 from pre-commit/update_many_repos
...
Allow autoupdate --repo to be specified multiple times
2018-02-24 17:04:18 -08:00
Anthony Sottile
29033f10ca
Move cwd() to tests-only
2018-02-24 16:44:59 -08:00
Anthony Sottile
f76d3c4f95
Allow autoupdate --repo to be specified multiple times
2018-02-24 15:42:26 -08:00
Anthony Sottile
b827694520
Each set of additional dependencies gets its own env
2018-02-24 15:28:43 -08:00
Anthony Sottile
bdad930d71
Move pre_commit.schema to cfgv library
2018-02-18 15:25:53 -08:00
Anthony Sottile
5c90c1a68f
Rewrite the hook template in python
2018-02-03 22:51:00 -08:00
Bastien Gérard
b319d6f80c
Add a hook option that allows stdout to be printed when exit code is 0 ( #695 )
2018-02-01 12:21:19 +01:00
Anthony Sottile
49dc689bf0
Fix legacy commit-msg hooks
2018-01-29 21:47:35 -08:00
Sam Duke
1bfd108593
Properly detect if commit is a root commit
...
Fix bad check for ancestor root commits.
2018-01-24 14:01:59 +00:00
Anthony Sottile
5a4dc0ce30
https-ify links
...
- A lot of http links loaded fine on https
- pre-commit.com is now loadable on https via cloudflare
2018-01-13 18:17:54 -08:00
Anthony Sottile
d5dcebf671
Deprecate the pcre language
2018-01-13 17:28:19 -08:00
Anthony Sottile
8fb644e7c0
Simplify prefix a bit
2018-01-13 16:08:18 -08:00
Anthony Sottile
6e46d6ae75
Support node on windows with long path hack
2018-01-12 22:31:43 -08:00
Anthony Sottile
7d87da8acd
Move PrefixedCommandRunner -> Prefix
2018-01-11 21:41:48 -08:00
Anthony Sottile
4d6efe1943
Merge pull request #680 from pre-commit/local_golang_repos
...
Fix broken local golang repos
2018-01-09 10:23:37 -08:00
Anthony Sottile
40690064f7
Fix broken local golang repos
2018-01-09 09:42:44 -08:00
Anthony Sottile
df38e1010b
Remove unused import
2018-01-09 08:49:42 -08:00
Iulian Onofrei
81df782c20
Update unstaged config file error message
2018-01-09 18:10:05 +02:00
Iulian Onofrei
8407b92b18
Replace string literals with constants
2018-01-09 17:51:41 +02:00
Anthony Sottile
029ccc47c8
Invoke git diff without a pager
2018-01-07 20:56:17 -08:00
Anthony Sottile
753979d720
Detect the python version based on the py launcher
2018-01-02 19:02:26 -08:00
Rory Prendergast
355196f92e
backs out unnecessary blank line
2018-01-02 13:05:41 -08:00
Rory Prendergast
9eadfb92fd
reduces line length
2018-01-02 13:05:41 -08:00
Rory Prendergast
e3cf0975f9
Adds whitelist for GIT_* env vars containing only GIT_SSH
2018-01-02 13:05:41 -08:00
Kevin Hock
090030447d
Combine blocks
2017-11-08 17:05:34 -08:00
Kevin Hock
dfb058f15f
Edit comment again
2017-11-08 15:55:05 -08:00
Kevin Hock
e4f28a2193
Edit comment
2017-11-08 15:53:08 -08:00
Kevin Hock
54ccb65a09
Add existing repo_config to output_repos
2017-11-08 15:50:04 -08:00
Anthony Sottile
fccb4e6935
Minor fixes
2017-11-06 18:14:59 -08:00
Kevin Hock
4d0c400066
Add repo option to autoupdate
2017-11-06 17:19:06 -08:00
Anthony Sottile
ae5b74ad38
always_run hooks always apply to the repository
2017-11-03 09:30:03 -07:00