From eb56c5b76fc7cd6bedeba7c608f25f6b69c6d37c Mon Sep 17 00:00:00 2001 From: Alexandre Hamez Date: Wed, 1 Jan 2025 20:28:05 +0100 Subject: [PATCH] misc: add script to check commit signatures --- .lefthook/pre-push/check_signatures.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 .lefthook/pre-push/check_signatures.sh diff --git a/.lefthook/pre-push/check_signatures.sh b/.lefthook/pre-push/check_signatures.sh new file mode 100755 index 00000000..086a73bf --- /dev/null +++ b/.lefthook/pre-push/check_signatures.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Get the name of the current branch +current_branch=$(git rev-parse --abbrev-ref HEAD) + +# Check if non-pushed commits are signed +if git log origin/"$current_branch"..HEAD --pretty=format:'%G?' | grep -qv "G"; then + echo "Error: One or more non-pushed commits are not signed." + exit 1 +else + echo "All non-pushed commits are properly signed." + exit 0 +fi