Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da80cc6

Browse files
committed
Allow init-templatedir to be called outside of git
1 parent 7f1e9c1 commit da80cc6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pre_commit/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
os.environ.pop('__PYVENV_LAUNCHER__', None)
3737

3838

39+
COMMANDS_NO_GIT = {'clean', 'gc', 'init-templatedir', 'sample-config'}
40+
41+
3942
def _add_color_option(parser):
4043
parser.add_argument(
4144
'--color', default=os.environ.get('PRE_COMMIT_COLOR', 'auto'),
@@ -273,7 +276,7 @@ def main(argv=None):
273276
parser.parse_args(['--help'])
274277

275278
with error_handler(), logging_handler(args.color):
276-
if args.command not in {'clean', 'gc', 'sample-config'}:
279+
if args.command not in COMMANDS_NO_GIT:
277280
_adjust_args_and_chdir(args)
278281

279282
git.check_for_cygwin_mismatch()

0 commit comments

Comments
 (0)