From b4a3765c2c85ab4cc80481c23993e2cf877c481e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 27 Aug 2017 21:51:49 +0200 Subject: [PATCH] Add script to check a branch for Signed-off-by lines in commits --- scripts/signed-off-by-in-branch.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 scripts/signed-off-by-in-branch.sh diff --git a/scripts/signed-off-by-in-branch.sh b/scripts/signed-off-by-in-branch.sh new file mode 100644 index 00000000..480f5a0a --- /dev/null +++ b/scripts/signed-off-by-in-branch.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Checks whether all commit between $1 and $2 have a signed-off-by line + +RED='\e[0;31m' # Red +NORMAL='\e[0m' # Text Reset + +faulty=$(git rev-list --grep "Signed-off-by" --invert-grep $1..$2 | wc -l) + +if [[ $faulty -eq 0 ]] +then + echo >&2 "All good" +else + echo -en >&2 "${RED}Got $faulty non Signed-off-by commits${NORMAL}" + echo -e >&2 "${RED}between $1 and $2${NORMAL}" +fi +