Skip to content

Commit 0cef260

Browse files
authored
Merge pull request #39 from gareth-rees/33-clang-format-diff
[#33] Handle exit status from clang-format version 18.
2 parents 7773753 + b7d9251 commit 0cef260

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: apply-format

+4-2
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,10 @@ else # Diff-only.
329329
-p1 \
330330
-style="$style" \
331331
-iregex="$exclusions_regex"'.*\.(c|cpp|cxx|cc|h|hpp|m|mm|js|java)' \
332-
> "$patch_dest" \
333-
|| exit 1
332+
> "$patch_dest"
333+
# Starting with version 18, clang-format-diff exits with status 1 when there
334+
# are diffs, but other non-zero statuses indicate errors.
335+
[ $? -gt 1 ] && exit $?
334336

335337
if [ "$apply_to_staged" = true ]; then
336338
if [ ! -s "$patch_dest" ]; then

0 commit comments

Comments
 (0)