Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ nproc=$(getconf _NPROCESSORS_ONLN || echo 1)

git ls-files -- ":/*.c" ":/*.h" | xargs -P "$nproc" -I {} sh -c '
# Ignore symlinks
if [[ ! -L {} ]]; then
Comment thread
mkannwischer marked this conversation as resolved.
Resolved
clang-format -i {}
fi'
if [[ ! -L "$1" ]]; then
clang-format -i "$1"
fi' _ {}

info "Expanding tabs"
expand-tabs()
{
git ls-files -- ":/" ":/!:Makefile" ":/!:**/Makefile" ":/!:**/Makefile.*" ":/!:Makefile.*" ":/!:*.mk" ":/!:*.patch" ":/!:nix/valgrind/*.txt" | xargs -P "$nproc" -I {} sh -c '
if [ ! -L {} ] && grep -Pq '"'"'\t'"'"' "{}"; then
if [ ! -L "$1" ] && grep -Pq '"'"'\t'"'"' "$1"; then
tmp=$(mktemp)
expand -t 4 "{}" > "$tmp" && mv "$tmp" "{}"
echo "{}"
fi'
expand -t 4 "$1" > "$tmp" && mv "$tmp" "$1"
echo "$1"
fi' _ {}
}
expand-tabs

Expand All @@ -83,9 +83,9 @@ check-eol()
{
git ls-files -- ":/" ":/!:*.png" | xargs -P "$nproc" -I {} sh -c '
# Ignore symlinks
if [[ ! -L {} && $(tail -c1 "{}" | wc -l) == 0 ]]; then
echo "" >>"{}"
echo "{}"
fi'
if [[ ! -L "$1" && $(tail -c1 "$1" | wc -l) == 0 ]]; then
echo "" >>"$1"
echo "$1"
fi' _ {}
}
check-eol
Loading