Skip to content

Commit

Permalink
Stop blocking on r-a
Browse files Browse the repository at this point in the history
  • Loading branch information
spectria-limina committed Dec 10, 2024
1 parent 456f49a commit 8d01146
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ACTION=check
while [[ $# -gt 0 ]]; do
case $1 in
-vv|--verbose=2)
VERBOSE="--verbose"
set -x
;&
-v|--verbose)
Expand Down Expand Up @@ -53,24 +52,30 @@ case $ACTION in
exit 1
}
TEMP=$(mktemp -d)
cargo run $QUIET -p tataru -- --all --out "$TEMP/assets"
if [ -v GIT_INDEX_FILE ]; then
if git diff --cached --exit-code --quiet assets tools/tataru; then
if [ -n "$VERBOSE" ]; then
echo "assets/ and tools/tataru unchanged: no need to run Tataru"
fi
else
cargo run $QUIET -p tataru -- --all --out "$TEMP/assets"
if [ -v GIT_INDEX_FILE ]; then
export GIT_INDEX_FILE=$(realpath $GIT_INDEX_FILE)
fi
git --work-tree="$TEMP" diff --exit-code $QUIET -- "assets/**/.listing" || {
fi
git --work-tree="$TEMP" diff --exit-code $QUIET -- "assets/**/.listing" || {
echo >&2 "ERROR: Listing files in assets/ need update."
echo >&2 " Run Tataru: 'cargo run -p tataru -- --all && git add -- assets/**/.listing'."
echo >&2 " Or just run '.githooks/pre-commit -u -v'."
echo >&2 " Run '.githooks/pre-commit -v' for more info."
exit 1
} && {
} && {
echo >&2 "All listing files in assets/ match"
}
}

if [ $NO_CLEANUP ]; then
if [ $NO_CLEANUP ]; then
echo >&2 "Leaving dirty files in $TEMP"
else
else
rm -r "$TEMP" || true
fi
fi
;;
update)
Expand Down

0 comments on commit 8d01146

Please sign in to comment.