From aa55cf75cddf83c10c4801f213632c84cfd13fe9 Mon Sep 17 00:00:00 2001 From: MARSHALL Date: Fri, 13 Feb 2026 10:58:27 +0530 Subject: [PATCH] improvised prof version Signed-off-by: MARSHALL --- dco-signoff-hook/prepare-commit-msg | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/dco-signoff-hook/prepare-commit-msg b/dco-signoff-hook/prepare-commit-msg index 3ca518f39..073a8a8e0 100755 --- a/dco-signoff-hook/prepare-commit-msg +++ b/dco-signoff-hook/prepare-commit-msg @@ -1,18 +1,31 @@ + #!/bin/sh +set -e + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi -NAME=$(git config user.name) -EMAIL=$(git config user.email) +if [ ! -f "$1" ]; then + echo "File not found: $1" + exit 2 +fi + +NAME=$(git config --get user.name) +EMAIL=$(git config --get user.email) if [ -z "$NAME" ]; then echo "empty git config user.name" - exit 1 + exit 3 fi if [ -z "$EMAIL" ]; then echo "empty git config user.email" - exit 1 + exit 4 fi -git interpret-trailers --if-exists doNothing --trailer \ - "Signed-off-by: $NAME <$EMAIL>" \ - --in-place "$1" \ No newline at end of file +git interpret-trailers \ + --if-exists addIfDifferent \ + --trailer "Signed-off-by: $NAME <$EMAIL>" \ + --in-place "$1"