c2c-sync/scripts/hooks/prepare-commit-msg

27 lines
520 B
Text
Raw Permalink Normal View History

2025-09-18 18:43:03 +02:00
#!/bin/sh
# Add Signed-off-by if not already present
# Nextcloud - Android Client
#
# SPDX-FileCopyrightText: 2025 Eeshan Jamal <eeshan.jamal@gmail.com>
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
COMMIT_MSG_FILE="$1"
# Validate existing sign off
if grep -qiE "^Signed-off-by: " "$COMMIT_MSG_FILE"; then
exit 0
fi
# Get current Git identity
NAME=$(git config user.name)
EMAIL=$(git config user.email)
# Append sign off
{
echo ""
echo "Signed-off-by: $NAME <$EMAIL>"
} >> "$COMMIT_MSG_FILE"