Skip to content

Commit

Permalink
Format: Ignore symlinks
Browse files Browse the repository at this point in the history
The examples in `examples/` contain many symlinks to the mlkem-native
source files. Previously, `format`, and specifically `clang-format`
invoked by it, would follow those symlinks and replace them by a copy
of the modified file if the linked file needed re-formatting. This is
not desirable: _only_ the file behind the symlink should be changed.

This commit fixes `format` by not running `clang-format` on symlinks.
  • Loading branch information
hanno-becker committed Jan 6, 2025
1 parent 5a008aa commit c5af04a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if ! command -v clang-format 2>&1 >/dev/null; then
echo "clang-format not found. Are you running in a nix shell? See BUILDING.md."
exit 1
fi
clang-format -i $(git ls-files ":/*.c" ":/*.h")
clang-format -i $(git ls-files ":/*.c" ":/*.h" | xargs -I {} sh -c "[ ! -L {} ] && echo '{}'")

info "Checking for eol"
check-eol()
Expand Down

0 comments on commit c5af04a

Please sign in to comment.