Don't run on untracked files.

This commit is contained in:
Jonas Diemer 2025-12-29 13:45:55 +01:00
parent a6e5dbb32c
commit 47cf4bd860

View File

@ -10,9 +10,8 @@ if [[ "$1" == "-g" ]]; then
# Use 'git ls-files' to get a list of all files with pending changes:
# --modified: files tracked by git that have been modified (staged or unstaged)
# --others: untracked files
# --exclude-standard: ignores files in .gitignore
git ls-files --modified --others --exclude-standard \
git ls-files --modified --exclude-standard \
| grep -E '\.(c|cpp|h|hpp)$' \
| xargs -r clang-format $STYLE_ARGS