projects
/
shutils.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0bbbd72
)
git pre-commit hook for tex checking
author
Stefan Huber <shuber@sthu.org>
Fri, 13 Dec 2013 12:38:27 +0000
(13:38 +0100)
committer
Stefan Huber <shuber@sthu.org>
Fri, 13 Dec 2013 12:38:27 +0000
(13:38 +0100)
git/pre-commit-texcheck
[new file with mode: 0755]
patch
|
blob
diff --git a/git/pre-commit-texcheck
b/git/pre-commit-texcheck
new file mode 100755
(executable)
index 0000000..
29547fe
--- /dev/null
+++ b/
git/pre-commit-texcheck
@@ -0,0
+1,24
@@
+#!/bin/sh
+
+set -e
+
+[ "$#" > "0" ] && cd "$1"
+
+tmpdir=$(mktemp -d)
+cleanup()
+{
+ rm -r "$tmpdir"
+}
+
+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
+ echo >&2 "pdflatex failed on '$f'."
+ cleanup
+ exit 1
+ fi
+done
+
+cleanup