Created
March 6, 2019 21:43
-
-
Save afrittoli/48129a3315b30d77afc839234e0617fb to your computer and use it in GitHub Desktop.
Git precommit to check if a tex source can be compiled and if the pdf is up to date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# pre-commit hook. | |
# It runs xelatex, and if changes are detected, it fails. | |
# Reproducible latex builds | |
SOURCE_DATE_EPOCH=0 SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1 xelatex tekton_knative.tex &> /dev/null | |
if [ ! $? -eq 0 ]; then | |
echo tekton_knative.tex cannot be compiled | |
tail -20 tekton_knative.log | |
exit 1 | |
fi | |
git diff --exit-code -- tekton_knative.pdf &> /dev/null | |
if [ ! $? -eq 0 ]; then | |
echo tekton_knative.pdf is out of date. Please stage it and try again. | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment