From f5e3002b84a437fa9dcb5d15d29d53181a0344d5 Mon Sep 17 00:00:00 2001 From: Wesley Schwengle Date: Thu, 25 Jan 2024 11:21:54 -0400 Subject: 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 --- git-clang-format.sh | 2 ++ 1 file changed, 2 insertions(+) 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 -- cgit v1.2.3-70-g09d2