add git hook to make sure assets/$version has been gitignored (#1006)

* add git hook to make sure assets/ hasn't been gitignored

* echo to stderr

* quiet git check-ignore

* add .v64 and .n64 to gitignore
This commit is contained in:
Alex Bates 2023-03-28 05:32:20 +01:00 committed by GitHub
parent 2c7b849152
commit e599c2e773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

7
.githooks.ini Normal file
View File

@ -0,0 +1,7 @@
# To refresh this file:
# python3 -m python_githooks
# Make sure dumped assets have not been unignored
# https://github.com/pmret/papermario/wiki/Asset-overrides
[pre-commit] # **** DO NOT REMOVE THIS!! ****
command = (git check-ignore assets/us -q && git check-ignore assets/jp -q && git check-ignore assets/ique -q && git check-ignore assets/pal -q) || (>&2 echo 'ERROR: You appear to be committing dumped assets!\nSee the following document for how to modify assets legally:\nhttps://github.com/pmret/papermario/wiki/Asset-overrides' && exit 1)

10
.gitignore vendored
View File

@ -24,9 +24,10 @@ build.ninja
*.ld
*.elf
*.z64
*.v64
*.n64
*.Yay0
*.msg.h
*.bin
*.i
*.o
*.zip
@ -41,7 +42,12 @@ build/
/tools/permuter_settings.toml
# Assets
/assets/*
# ** DO NOT UNIGNORE THESE FILES!! SEE THE FOLLOWING LINK IF YOU'RE MODDING ASSETS:**
# https://github.com/pmret/papermario/wiki/Asset-overrides
/assets/us
/assets/jp
/assets/pal
/assets/ique
# Star Rod
/sprite/SpriteTable.xml

View File

@ -33,6 +33,7 @@ if [[ "$uname" == "Darwin" ]]; then
# Install packages
brew install md5sha1sum ninja gcc nanaian/brew/mips-linux-gnu-binutils || exit 1
python3 -m pip install -U -r requirements.txt || exit 1
python3 -m python_githooks || exit 1
if [[ $1 == "--extra" ]]; then
echo "Installing extra"
@ -49,6 +50,7 @@ if cat /etc/os-release | grep -E 'ID=debian|ID_LIKE=(.*)debian' &> /dev/null; th
${SUDO} apt install -y curl git python3 python3-pip python3-setuptools build-essential binutils-mips-linux-gnu zlib1g-dev libyaml-dev ninja-build cpp-mips-linux-gnu || exit 1
python3 -m pip install -U -r requirements.txt
python3 -m python_githooks || exit 1
if [[ $1 == "--extra" ]]; then
echo "Installing extra"
@ -69,6 +71,7 @@ if cat /etc/os-release | grep -E 'ID=arch|ID_LIKE=arch' &> /dev/null; then
# Install dependencies
${SUDO} pacman -S --noconfirm --needed curl git python python-pip python-setuptools base-devel zlib libyaml ninja || exit 1
python3 -m pip install -U -r requirements.txt
python3 -m python_githooks || exit 1
# Install binutils if required
if ! command -v mips-linux-gnu-ar &> /dev/null; then
@ -123,6 +126,7 @@ if cat /etc/os-release | grep ID=opensuse &> /dev/null; then
${SUDO} ln -s /usr/bin/mips-suse-linux-strip /usr/bin/mips-linux-gnu-strip
python3 -m pip install -U -r requirements.txt
python3 -m python_githooks || exit 1
if [[ $1 == "--extra" ]]; then
echo "Installing extra"
@ -145,6 +149,7 @@ if cat /etc/os-release | grep ID=alpine &> /dev/null; then
# Install dependencies
${SUDO} apk add --no-cache bash curl wget git python3 python3-dev py3-pip build-base zlib-dev yaml-dev ninja
python3 -m pip install -U -r requirements.txt
python3 -m python_githooks || exit 1
# Install binutils if required
if ! command -v mips-linux-gnu-ar &> /dev/null; then

View File

@ -11,3 +11,4 @@ pygfxd
intervaltree
rabbitizer
n64img
python-githooks