summaryrefslogtreecommitdiff
path: root/git-clang-format.sh
diff options
context:
space:
mode:
authorWesley Schwengle <wesleys@opperschaap.net>2024-01-25 11:21:54 -0400
committerWesley Schwengle <wesleys@opperschaap.net>2024-01-25 11:30:07 -0400
commitf5e3002b84a437fa9dcb5d15d29d53181a0344d5 (patch)
treec71a8397f2787bace52f9b0aa2b77c904e8d5a2a /git-clang-format.sh
parent2845127968cda30be8423e1d3a24dae0e797bcc8 (diff)
Fix bug where ./git-clang-format.sh errors incorrectly
When running the following command twice: ./git-clang-format.sh $(git merge-base HEAD @{u}) The tool previously errored with the following message: patch: **** Only garbage was found in the patch input. This is because on a second run there is nothing to patch. Fix that small issue by excluding the line 'clang-format did not modify any files' and the line 'no modified files to format' Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
Diffstat (limited to 'git-clang-format.sh')
-rwxr-xr-xgit-clang-format.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/git-clang-format.sh b/git-clang-format.sh
index 6348652c1..da6e6d8c2 100755
--- a/git-clang-format.sh
+++ b/git-clang-format.sh
@@ -7,4 +7,6 @@ if [ -z "$CLANG_FORMAT" ]; then
fi
git "$(basename "$CLANG_FORMAT" | cut -d'-' -f 2-)" --diff "$@" | \
sed "s#+/\*\}\}\}\*/#+ /*}}}*/#" | \
+ grep -v '^clang-format did not modify any files$' | \
+ grep -v '^no modified files to format$' | \
patch -p1