forked from kaydotai/longlistbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit
More file actions
executable file
·38 lines (29 loc) · 1005 Bytes
/
Copy pathpre-commit
File metadata and controls
executable file
·38 lines (29 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Pre-commit hook to ensure the paper compiles successfully
echo "Running pre-commit hook: Compiling paper..."
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)"
if [[ -z "$REPO_ROOT" ]]; then
echo "(pre-commit) Not in a git repo; skipping."
exit 0
fi
if ! command -v make >/dev/null 2>&1; then
echo "(pre-commit) 'make' not found; skipping paper compile."
exit 0
fi
if [[ ! -f "$REPO_ROOT/paper/Makefile" ]]; then
echo "(pre-commit) paper/Makefile not found; skipping."
exit 0
fi
# Best-effort quick compile (single pass, no bibliography update).
# Set STRICT_PAPER_COMPILE=1 to make failures block the commit.
if make -C "$REPO_ROOT/paper" quick; then
echo "✓ Paper compiled successfully!"
exit 0
fi
echo "(pre-commit) Paper quick-compile failed."
echo "(pre-commit) To reproduce: make -C paper quick"
echo "(pre-commit) You can skip hooks with: git commit --no-verify"
if [[ "${STRICT_PAPER_COMPILE:-0}" == "1" ]]; then
exit 1
fi
exit 0