Skip to content

Commit b7d9251

Browse files
committed
[#33] Handle exit status from clang-format version 18.
1 parent ac35e70 commit b7d9251

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apply-format

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,10 @@ else # Diff-only.
325325
-p1 \
326326
-style="$style" \
327327
-iregex="$exclusions_regex"'.*\.(c|cpp|cxx|cc|h|hpp|m|mm|js|java)' \
328-
> "$patch_dest" \
329-
|| exit 1
328+
> "$patch_dest"
329+
# Starting with version 18, clang-format-diff exits with status 1 when there
330+
# are diffs, but other non-zero statuses indicate errors.
331+
[ $? -gt 1 ] && exit $?
330332

331333
if [ "$apply_to_staged" = true ]; then
332334
if [ ! -s "$patch_dest" ]; then

0 commit comments

Comments
 (0)