aboutsummaryrefslogtreecommitdiff
path: root/.githooks
diff options
context:
space:
mode:
authorDenis Chevalier <perso@denischevalier.fr>2026-08-11 01:48:41 +0200
committerDenis Chevalier <perso@denischevalier.fr>2026-08-11 01:48:41 +0200
commit10398290704e99a969aec921bb392af6552b383a (patch)
tree6471935dabf9d9c66ad0b886b5394bab58b2d3de /.githooks
parentd7621adc4bbbf7f9779f5cf33ee95dbc31d92ecd (diff)
downloadsame-10398290704e99a969aec921bb392af6552b383a.tar.gz
same-10398290704e99a969aec921bb392af6552b383a.tar.bz2
same-10398290704e99a969aec921bb392af6552b383a.zip
typo in README.md, add git hook for new typ files SPDX header
Diffstat (limited to '.githooks')
-rwxr-xr-x.githooks/pre-commit35
1 files changed, 35 insertions, 0 deletions
diff --git a/.githooks/pre-commit b/.githooks/pre-commit
new file mode 100755
index 0000000..7f9d85e
--- /dev/null
+++ b/.githooks/pre-commit
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+HEADER='// SAME Analog Modular Ecosystem
+//
+// / SPDX-FileCopyrightText: 2026 Denis Chevalier <perso@denischevalier.fr>
+// / SPDX-License-Identifier: CC-BY-SA-4.0
+// / SPDX-License-Identifier: CERN-OHL-S-2.0+
+// / SPDX-License-Identifier: GPL-3.0-or-later
+//
+// The prose, explanatory text, rendered figures, tables, and mathematical
+// content of this specification are licensed under CC BY-SA 4.0. If a later
+// version of CC BY-SA is published, the author grants permission to distribute
+// this work under that later version as well.
+//
+// Hardware designs contained herein (schematics, PCB layouts, mechanical
+// drawings, and CAD models) are licensed under CERN-OHL-S-2.0+.
+//
+// All executable code, helper libraries (`lib/*`), metrology assertions, and
+// embedded verification scripts throughout the source documents are licensed
+// under the GNU General Public License v3.0 or later (GPL-3.0-or-later).'
+
+# Find newly added staged .typ files
+new_files=$(git diff --cached --name-only --diff-filter=A | grep '\.typ$')
+
+for file in $new_files; do
+ if [ -f "$file" ] && ! grep -q "SPDX-FileCopyrightText" "$file"; then
+ echo "Injecting SPDX header into $file..."
+ tmpfile=$(mktemp)
+ echo "$HEADER" > "$tmpfile"
+ echo "" >> "$tmpfile"
+ cat "$file" >> "$tmpfile"
+ mv "$tmpfile" "$file"
+ git add "$file"
+ fi
+done