Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New clang-format-diff returns a non-zero status code when diffs exist leading apply-format to fail #33

Open
ynyyn opened this issue Apr 10, 2024 · 0 comments · May be fixed by #35
Open

Comments

@ynyyn
Copy link

ynyyn commented Apr 10, 2024

Starting from llvm/llvm-project#70883 (around LLVM version 18.1.0), the clang-format-diff script now will exit with a non-zero status code if it detects there has formatting changes.

And this change from LLVM clang-format will break the assuming in apply-format script, here at L329,

"${git_args[@]}" "$@" \
| "${format_diff_args[@]}" \
-p1 \
-style="$style" \
-iregex="$exclusions_regex"'.*\.(c|cpp|cxx|cc|h|hpp|m|mm|js|java)' \
> "$patch_dest" \
|| exit 1

which stops apply-format to apply the diff as format fix to the local or git-staged files.

ptomato added a commit to ptomato/clang-format-hooks that referenced this issue Jul 28, 2024
Starting with 18.x, clang-format-diff exits with a nonzero exit code if
there was a diff to be applied. This breaks the apply-format script
because it will exit without printing the diff. Instead, ignore the exit
code and proceed to print the diff.

Closes: barisione#33
@ptomato ptomato linked a pull request Jul 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant