File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Palimpsest pre-push hook
4+ # Heavy validation: cross-links, SPDX, exhibits
5+
6+ echo " Running Palimpsest pre-push checks..."
7+
8+ # 1. Validate SPDX headers
9+ for file in $( git ls-files | grep -E ' \.(adoc|txt)$' ) ; do
10+ if ! grep -q " SPDX-License-Identifier:" " $file " ; then
11+ echo " ERROR: Missing SPDX header in $file "
12+ exit 1
13+ fi
14+ done
15+
16+ # 2. Validate cross-links
17+ BROKEN_LINKS=0
18+ for link in $( grep -Rho " link:[^[]*" legal/ spec/ | sed ' s/link://' ) ; do
19+ if [ ! -f " $link " ]; then
20+ echo " ERROR: Broken link: $link "
21+ BROKEN_LINKS=1
22+ fi
23+ done
24+
25+ if [ " $BROKEN_LINKS " -eq 1 ]; then
26+ exit 1
27+ fi
28+
29+ # 3. Validate exhibits
30+ if [ -f " .githooks/validate-exhibit" ]; then
31+ .githooks/validate-exhibit || exit 1
32+ fi
33+
34+ echo " Pre-push checks passed."
35+ exit 0
You can’t perform that action at this time.
0 commit comments