Skip to content

Commit

Permalink
Fix lint task (WebAssembly#2546)
Browse files Browse the repository at this point in the history
git clang-format appears to now return an exit status instead of always
succeeding, and the change broke the script. this fixes it.
  • Loading branch information
SoniEx2 authored Feb 18, 2025
1 parent 508984b commit 40be47d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions scripts/clang-format-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ else
fi

MERGE_BASE=$(git merge-base $BRANCH HEAD)
FORMAT_MSG=$(git clang-format $MERGE_BASE -q --diff -- src/)
if [ -n "$FORMAT_MSG" -a "$FORMAT_MSG" != "no modified files to format" ]
then
if ! git clang-format $MERGE_BASE -q --diff -- src/ 2>&1 >/dev/null; then
echo "Please run git clang-format before committing, or apply this diff:"
echo
# Run git clang-format again, this time without capruting stdout. This way
# clang-format format the message nicely and add color.
# Run git clang-format again, this time with output. This lets us add
# the above message.
git clang-format $MERGE_BASE -q --diff -- src/
exit 1
fi

0 comments on commit 40be47d

Please sign in to comment.