From a0738e6ea18b766041edca2f341b6699c951b96d Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 17 Feb 2026 21:25:57 +0100 Subject: [PATCH] chore(git): Add pre-push hook to enforce 'v' prefix on tags --- .husky/pre-push | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 .husky/pre-push diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 00000000..c29e8f9e --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,32 @@ +#!/bin/sh + +# Husky pre-push hook to validate tags +# Strictly enforces that all pushed tags start with 'v' (e.g., v1.0.0) + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha +do + # Check if we are pushing a tag + case "$local_ref" in + refs/tags/*) + tag_name="${local_ref#refs/tags/}" + if ! echo "$tag_name" | grep -q "^v[0-9]"; then + echo "" + echo "❌ ERROR: Invalid tag name '$tag_name'" + echo "--------------------------------------------------" + echo "Consistency check failed: All tags MUST start with 'v'." + echo "Example: v1.0.10" + echo "" + echo "Please delete the invalid tag and create a new one:" + echo " git tag -d $tag_name" + echo " git tag v$tag_name" + echo "--------------------------------------------------" + echo "" + exit 1 + fi + ;; + esac +done + +exit 0