#!/bin/bash set -euo pipefail cd "$(dirname "$0")/.." if (( $# != 1 )); then printf 'Usage: Scripts/check-commit-message.sh MESSAGE_FILE\n' >&2 exit 2 fi trailers=$(git interpret-trailers --parse "$1") if ! grep -Eq '^Signed-off-by: [^<>]+ <[^<>[:space:]]+@[^<>[:space:]]+>$' <<< "$trailers"; then printf 'Add a DCO sign-off with git commit -s.\n' >&2 exit 1 fi Scripts/check-names.sh --staged --commit-msg "$1"