mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Remove --no-stash and --allow-unstaged-config
This commit is contained in:
parent
7139a47c1c
commit
6793fd8e5d
4 changed files with 12 additions and 87 deletions
|
|
@ -217,7 +217,7 @@ def _has_unstaged_config(runner):
|
|||
|
||||
|
||||
def run(runner, args, environ=os.environ):
|
||||
no_stash = args.no_stash or args.all_files or bool(args.files)
|
||||
no_stash = args.all_files or bool(args.files)
|
||||
|
||||
# Check if we have unresolved merge conflict files and fail fast.
|
||||
if _has_unmerged_paths(runner):
|
||||
|
|
@ -227,20 +227,11 @@ def run(runner, args, environ=os.environ):
|
|||
logger.error('Specify both --origin and --source.')
|
||||
return 1
|
||||
if _has_unstaged_config(runner) and not no_stash:
|
||||
if args.allow_unstaged_config:
|
||||
logger.warn(
|
||||
'You have an unstaged config file and have specified the '
|
||||
'--allow-unstaged-config option.\n'
|
||||
'Note that your config will be stashed before the config is '
|
||||
'parsed unless --no-stash is specified.',
|
||||
)
|
||||
else:
|
||||
logger.error(
|
||||
'Your .pre-commit-config.yaml is unstaged.\n'
|
||||
'`git add .pre-commit-config.yaml` to fix this.\n'
|
||||
'Run pre-commit with --allow-unstaged-config to silence this.',
|
||||
)
|
||||
return 1
|
||||
logger.error(
|
||||
'Your .pre-commit-config.yaml is unstaged.\n'
|
||||
'`git add .pre-commit-config.yaml` to fix this.\n',
|
||||
)
|
||||
return 1
|
||||
|
||||
# Expose origin / source as environment variables for hooks to consume
|
||||
if args.origin and args.source:
|
||||
|
|
|
|||
|
|
@ -135,10 +135,6 @@ def main(argv=None):
|
|||
_add_color_option(run_parser)
|
||||
_add_config_option(run_parser)
|
||||
run_parser.add_argument('hook', nargs='?', help='A single hook-id to run')
|
||||
run_parser.add_argument(
|
||||
'--no-stash', default=False, action='store_true',
|
||||
help='Use this option to prevent auto stashing of unstaged files.',
|
||||
)
|
||||
run_parser.add_argument(
|
||||
'--verbose', '-v', action='store_true', default=False,
|
||||
)
|
||||
|
|
@ -154,13 +150,6 @@ def main(argv=None):
|
|||
'--commit-msg-filename',
|
||||
help='Filename to check when running during `commit-msg`',
|
||||
)
|
||||
run_parser.add_argument(
|
||||
'--allow-unstaged-config', default=False, action='store_true',
|
||||
help=(
|
||||
'Allow an unstaged config to be present. Note that this will '
|
||||
'be stashed before parsing unless --no-stash is specified.'
|
||||
),
|
||||
)
|
||||
run_parser.add_argument(
|
||||
'--hook-stage', choices=('commit', 'push', 'commit-msg'),
|
||||
default='commit',
|
||||
|
|
@ -173,7 +162,7 @@ def main(argv=None):
|
|||
run_mutex_group = run_parser.add_mutually_exclusive_group(required=False)
|
||||
run_mutex_group.add_argument(
|
||||
'--all-files', '-a', action='store_true', default=False,
|
||||
help='Run on all the files in the repo. Implies --no-stash.',
|
||||
help='Run on all the files in the repo.',
|
||||
)
|
||||
run_mutex_group.add_argument(
|
||||
'--files', nargs='*', default=[],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue