[Bug] Remove symbol-less `public` directives in the pre-commit hook

Another issue related to `public` that causes TASM32 version 5.0 to
crash. Better staying on that version from now on…
Thanks to spaztron64 for reporting this one!
This commit is contained in:
nmlgc 2024-04-02 03:10:35 +02:00
parent ff19bedc18
commit b6a7285847
2 changed files with 8 additions and 3 deletions

View File

@ -8,11 +8,17 @@ else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
# Remove trailing commas from `public` directives. These crash on TASM32
# version 5.0, but work on later versions.
# 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.
for f in `git diff-index --name-only --cached --diff-filter=ACMRX ${against} | grep \.asm$ -i`; do
if [ -n "$(sed -b -i -E 's/(public\s+[^;]+?),\s*(;.*)?$/\1\2/w /dev/stdout' "$f")" ]; then
echo "$f"': removed a trailing comma from a `public` line, please re-stage.'
exit 1
fi
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
done

View File

@ -29710,7 +29710,6 @@ _ITEM_PATNUM label byte
include th02/main/power_overflow[data].asm
_item_skill dw 0
public
public _ITEM_MISS_VELOCITY_Y_CENTER
_ITEM_MISS_VELOCITY_Y_SIDES db 0B0h, 0BCh, 0C8h, 0D4h, 0E0h
_ITEM_MISS_VELOCITY_X_CENTER db -2, -1, 0, 1, 2