From: Stefan Huber Date: Mon, 13 Jan 2014 09:47:52 +0000 (+0100) Subject: git: update pre-commit-texcheck X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=bf071c211651c1e81d6e8a91ddd9234ba80a4986;p=shutils.git git: update pre-commit-texcheck Change working directory if tex file is in a sub-directory. --- diff --git a/git/pre-commit-texcheck b/git/pre-commit-texcheck index 29547fe..dae2418 100755 --- a/git/pre-commit-texcheck +++ b/git/pre-commit-texcheck @@ -14,11 +14,16 @@ for f in $(find -name "*.tex"); do # Only main tex files are interesting grep -q "\documentclass" "$f" || continue - if ! pdflatex -output-directory "$tmpdir" $f < /dev/null > /dev/null; then + pushd . + cd $(dirname $f) + + if ! pdflatex -output-directory "$tmpdir" $(basename $f) < /dev/null > /dev/null; then + popd echo >&2 "pdflatex failed on '$f'." cleanup exit 1 fi + popd done cleanup