#!/bin/bash
#
# Remove all trailing whitespace in the files about to be committed.

for f in $(git status --porcelain | \
                  sed -n -e 's/^M \+\(.*\.\(cpp\|h\|C\)\)/\1/p')
do \
  sed -i -e 's/ \+$//' -e 's/	\+$//' $f
  git add $f
done

# Relaxing this check now that it's done in GitHub Actions
# $(git rev-parse --show-toplevel)/devel-tools/check_build_recipes || exit 1

exit 0
