Commit Graph

83 Commits

Author SHA1 Message Date
Michael Adkins
02d95c033c Fixed code style 2019-07-09 13:48:06 -05:00
Michael Adkins
c148845a98 Added hook-stage print to output for missing hook id 2019-07-09 13:06:18 -05:00
Mandar Vaze
3d7b374bef Pass correct value to git color based on args.color 2019-06-01 17:33:27 +05:30
Mandar Vaze
64f0178b75 Pass color option to git diff unconditionally 2019-06-01 07:40:20 +05:30
Mandar Vaze
4f4767c9e0 Pass color option to git diff (on failure)
Fixes #1007
2019-05-31 16:42:16 +05:30
Marc Jay
82969e4ba3 Use set rather than list for commit message related stages, remove
default file open modes, tidy up bash call for failing hook test
2019-04-21 21:58:01 +01:00
Marc Jay
e60f541559 Adds support for prepare-commit-msg hooks
Adds a prepare-commit-msg hook stage which allows for hooks which add
dynamic suggested/placeholder text to commit messages that an author can
use as a starting point for writing a commit message
2019-04-21 21:07:13 +01:00
Anthony Sottile
668e6415c0 Adjust messaging slightly 2019-03-30 14:05:24 -07:00
Ben Norquist
71a740d65d add helpful message and test 2019-03-30 14:00:03 -07:00
Anthony Sottile
dc28922ccb Run pre-commit autoupdate
Committed via https://github.com/asottile/all-repos
2019-03-21 21:09:33 -07:00
Anthony Sottile
b1389603e0 Speed up filename filtering.
Before there was a `getcwd` syscall for every filename which was filtered.

Instead this is now cached per-run.

- When all files are identified by filename only: ~45% improvement
- When no files are identified by filename only: ~55% improvement

This makes little difference to overall execution, the bigger win is
eliminating the `memoize_by_cwd` hack.  Just removing the memoization would
have *increased* the runtime by 300-500%.
2019-01-23 20:48:41 -08:00
Anthony Sottile
bd65d8947f Implement default_stages 2019-01-06 10:32:58 -08:00
Anthony Sottile
bdc58cc33f Teach pre-commit try-repo to clone uncommitted changes 2019-01-01 15:01:36 -08:00
Anthony Sottile
c577ed92e7 Refactor pre_commit.repository and factor out cached-property 2018-12-30 20:56:49 -08:00
Pedro Algarvio
8ffd1f69d7 Address review comments 2018-12-27 17:18:11 +00:00
Pedro Algarvio
79c8b1fceb Allow hook alias to be used in SKIP. Includes test. 2018-12-27 12:03:27 +00:00
Pedro Algarvio
5840f880a9 Address review comments and test failures 2018-12-27 12:03:27 +00:00
Pedro Algarvio
b096c0b8f2 Allow aliasing a hook and calling it by it's alias 2018-12-27 12:03:27 +00:00
Anthony Sottile
fe409f1a43 Remove stateful Runner 2018-12-26 22:33:21 -08:00
Matt Layman
fd1bc21d8e Use parens instead of different logic pattern. 2018-07-19 23:27:29 -04:00
Matt Layman
4640dc7b4a Run only the specified hook even when stages exist in config.
This branches fixes the run logic so that when
`pre-commit run some_hook -a` runs when the config contains
`stages: ['commit']` for some other hook, only the hook specified as an
argument will run.

Fixes #772
2018-07-19 21:45:43 -04:00
Anthony Sottile
c947a0935d Fix buffering in --show-diff-on-failure 2018-07-17 18:24:16 -07:00
Anthony Sottile
c01ffc83f8 Separate store from runner 2018-06-29 22:35:53 -07:00
Anthony Sottile
5b6a5abae9 Consistent ordering of filenames 2018-06-11 12:49:45 -07: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
d5dcebf671 Deprecate the pcre language 2018-01-13 17:28:19 -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
10912fa03e Lazily install repositories 2017-10-20 13:04:33 -07:00
Anthony Sottile
18c9e061d8 Small cleanups 2017-09-30 15:53:44 -07:00
Anthony Sottile
ecdc22ce80 Implement global exclude 2017-09-10 15:09:44 -07:00
Anthony Sottile
6af60158ec Refactor filename collection for hooks 2017-09-09 22:07:27 -07:00
Anthony Sottile
898a3ea1bb Implement fail_fast. 2017-09-08 13:19:00 -07:00
Anthony Sottile
6141c419ee Remove Runner.cmd_runner and Store.cmd_runner 2017-09-05 14:49:31 -07:00
Anthony Sottile
0815108242 Handle non-ascii filenames from git 2017-09-05 08:10:16 -07:00
Anthony Sottile
bba711f468 Remove extra newline on error() call 2017-08-23 14:20:44 -07:00
Anthony Sottile
6793fd8e5d Remove --no-stash and --allow-unstaged-config 2017-08-23 11:16:37 -07:00
Anthony Sottile
d0b268c813 Add support for commit-msg git hook 2017-07-23 20:50:25 -07:00
Anthony Sottile
0c70fa4229 Use asottile/add-trailing-comma 2017-07-12 18:30:51 -07:00
Anthony Sottile
05a108efe1 Implement exclude_types 2017-07-02 19:08:33 -07:00
Anthony Sottile
a58d99ac40 Implement types filtering 2017-07-02 18:51:23 -07:00
Anthony Sottile
a68c1ab0d2 Add 'types' to the schema 2017-07-02 13:20:39 -07:00
Anthony Sottile
7b6ea994b8 Expose --source and --origin as environment variables 2017-06-27 10:08:16 -07:00
Anthony Sottile
321210d332 Run git diff with --no-ext-diff 2017-06-09 08:34:04 -07:00
Anthony Sottile
e150921c75 Followup to #533, match no files when omitted 2017-06-02 08:39:10 -07:00
Dain Liffman
d731652a22 Fix for #533 2017-05-31 10:09:42 +08:00
André Berti Sassi
e774c09fac Add pass_filenames hook option
This option controls whether filenames are passed along as arguments to
the hook program.
2017-05-13 14:28:17 -03:00
Anthony Sottile
840a55bbc3 Fixup log_file commit 2017-05-08 11:04:07 -07:00