#!/usr/bin/env bash
#
# Helper Git commit hook to ensure the DCO sign-off is present, to avoid
# creating multiple commits without the DCO sign-off which is annoying to fix
# and is required.
#

if ! grep -qE '^Signed-off-by: ' "$1"; then
    echo "Your commit message is not signed off with the DCO." >&2
    echo "" >&2
    echo "Please read and agree to the DCO: https://developercertificate.org/" >&2
    echo "" >&2
    echo "Hint: Use 'git commit -s' flag to sign your commits" >&2
    echo "" >&2
    echo "Hint: Use 'git commit -seF .git/COMMIT_EDITMSG' to recover your commit message and sign." >&2
    exit 1
fi