2023-03-20 00:29:50 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if git rev-parse --verify HEAD >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
against=HEAD
|
|
|
|
else
|
|
|
|
# Initial commit: diff against an empty tree object
|
|
|
|
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
|
|
fi
|
|
|
|
|
2024-04-02 01:10:35 +00:00
|
|
|
# Remove trailing commas from `public` directives, as well as `public`
|
|
|
|
# directives without arguments. These crash on TASM32 version 5.0, but work on
|
|
|
|
# later versions.
|
2023-03-20 00:29:50 +00:00
|
|
|
for f in `git diff-index --name-only --cached --diff-filter=ACMRX ${against} | grep \.asm$ -i`; do
|
2023-04-16 17:36:42 +00:00
|
|
|
if [ -n "$(sed -b -i -E 's/(public\s+[^;]+?),\s*(;.*)?$/\1\2/w /dev/stdout' "$f")" ]; then
|
2023-03-20 00:29:50 +00:00
|
|
|
echo "$f"': removed a trailing comma from a `public` line, please re-stage.'
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-04-02 01:10:35 +00:00
|
|
|
if grep -q -E "^public$" "$f"; then
|
|
|
|
sed -b -i -E '/^public\r?$/d' "$f"
|
|
|
|
echo "$f"': removed a symbol-less `public`, please re-stage.'
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-03-20 00:29:50 +00:00
|
|
|
done
|