summaryrefslogtreecommitdiff
path: root/.pre-commit-config.yaml
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2021-03-15 15:13:10 -0500
committerJeff Epler <jepler@gmail.com>2021-03-15 15:19:23 -0500
commitc2ed1b0942740cf6a6d061f1a058245d31490521 (patch)
tree18e924b72f14994da59ac13a0338637ff69f10e0 /.pre-commit-config.yaml
parent05ed179e11599dd45a76dfb14ecf624d0ff96d68 (diff)
pre-commit: only run uncrustify if changed files are detected
This adds the "no-run-if-empty" flag to the xargs invocation. Otherwise, if git diff names no files, the command is run once with no agument specified which leads to running on a default list of files that appears to include ignored files and files in submodules. I am uneasy about how this works (it means that `pre-commit run --all` doesn't actually check all files) but that's a separate issue.
Diffstat (limited to '.pre-commit-config.yaml')
-rw-r--r--.pre-commit-config.yaml2
1 files changed, 1 insertions, 1 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5f7fc8c12..aa6bda102 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,6 +21,6 @@ repos:
language: system
- id: formatting
name: Formatting
- entry: sh -c "git diff --staged --name-only | xargs python3 tools/codeformat.py"
+ entry: sh -c "git diff --staged --name-only | xargs -r python3 tools/codeformat.py"
types_or: [c, python]
language: system