New option to auto-add files modified by hooks

This commit is contained in:
Mike Mabey 2019-09-21 17:01:47 -06:00
parent 858e89865e
commit 094f8aa0a4
4 changed files with 21 additions and 1 deletions

View file

@ -108,6 +108,15 @@ def _add_run_options(parser):
'Equivalent to setting the environment variable '
'PRE_COMMIT_MODIFIED_FILES_OK=true.',
)
parser.add_argument(
'--add-modified', action='store_true',
default='PRE_COMMIT_ADD_MODIFIED_FILES' in os.environ,
help='Any file modifications made by hooks will be automatically '
'added to the index unless any hook fails. When set, file '
"modification by hooks won't be equated with failure (same as if "
'--modified-files-ok is set). Equivalent to setting the '
'environment variable PRE_COMMIT_ADD_MODIFIED_FILES=true.',
)
mutex_group = parser.add_mutually_exclusive_group(required=False)
mutex_group.add_argument(
'--all-files', '-a', action='store_true', default=False,