pre-commit/pre_commit
Venkateswara Rao Mandela ac1301417b feat(run): warn instead of error when --files is used outside a git repo
When `pre-commit run --files <files>` is called outside a git
repository, the tool previously raised a FatalError and exited
with code 1.

- Print a warning that pre-commit is running outside a git
  repository and only the explicitly passed files will be checked
- Continue execution rather than aborting
- All other commands (and `run` without `--files`) retain the
  existing fatal error behavior

This modification helps use pre-commit in jujutsu worktrees as long
as the modified file list is supplied on command line.

Signed-off-by: Venkateswara Rao Mandela <venkat.mandela@gmail.com>
2026-04-05 20:10:21 +05:30
..
commands add pre-commit hazmat 2025-11-22 13:53:53 -05:00
languages Fix docker-in-docker detection for cgroups v2 2025-11-08 15:37:32 -05:00
meta_hooks python3.9+ 2023-10-28 14:20:37 -04:00
resources fix python local template when artifact dirs are present 2025-12-16 15:45:01 -05:00
__init__.py Initial commit. 2014-03-12 20:25:19 -07:00
__main__.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
all_languages.py rename system and script languages to unsupported / unsupported_script 2025-11-08 15:09:16 -05:00
clientlib.py add forward-compat error message 2025-11-19 14:57:01 -05:00
color.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
constants.py make --hook-type and stages match 2023-03-11 14:26:14 -05:00
envcontext.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2024-07-29 21:59:19 +00:00
error_handler.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2024-07-29 21:59:19 +00:00
errors.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
file_lock.py py310+ 2025-10-09 17:44:05 -04:00
git.py fix deprecated call 2025-10-16 10:23:30 -04:00
hook.py python3.9+ 2023-10-28 14:20:37 -04:00
lang_base.py add pre-commit hazmat 2025-11-22 13:53:53 -05:00
logging_handler.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2024-07-29 21:59:19 +00:00
main.py feat(run): warn instead of error when --files is used outside a git repo 2026-04-05 20:10:21 +05:30
output.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
parse_shebang.py python3.9+ 2023-10-28 14:20:37 -04:00
prefix.py drop python 3.6 support 2022-01-18 18:44:20 -05:00
repository.py remove deprecated python_venv alias 2024-10-05 13:30:25 -04:00
staged_files_only.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2024-07-29 21:59:19 +00:00
store.py move logic for gc back to commands.gc 2025-11-19 14:32:09 -05:00
util.py py310+ 2025-10-09 17:44:05 -04:00
xargs.py py310+ 2025-10-09 17:44:05 -04:00
yaml.py change migrate-config to use yaml parse tree instead 2024-09-16 20:16:16 -04:00
yaml_rewrite.py change migrate-config to use yaml parse tree instead 2024-09-16 20:16:16 -04:00