Re: [PATCH hooks 1/1] Add check for Signed-off-by in commit messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 22, 2018 at 12:05:19PM +0000, Daniel P. Berrange wrote:
This extends the update hook so that it enforces a requirement to have a
Signed-off-by line in every commit message. This can be optionally
turned off in individual repos by setting the "hooks.allowmissingsob"
git config variable.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
update | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)


Given that signed-off-by lines are pointless for patches authored and
committed by the same person,

NACK unless the hooks.allowmissingsob will be set in the main
libvirt.git (I don't really care about other repos).

Jan

diff --git a/update b/update
index 6a8edcb..b7cfe7f 100755
--- a/update
+++ b/update
@@ -248,7 +248,21 @@ if [ $check_diff = yes ]; then
	if [ "$allow_bad_whitespace" != "true" ]; then
		test "$oldrev" = $zero \
			&& exit 0
-		exec git diff --check $oldrev $newrev --
+		git diff --check $oldrev $newrev --
+		test $? != 0 && exit 1
+	fi
+
+	allow_missing_sob=$(git config --bool hooks.allowmissingsob)
+	if [ "$allow_missing_sob" != "true" ]; then
+		for rev in `git log --format=%h $oldrev..$newrev`
+		do
+			git show $rev | grep Signed-off-by >/dev/null 2>&1
+			if test $? != 0
+			then
+				echo "*** Update hook: missing Signed-off-by tag in $rev" >&2
+				exit 1
+			fi
+		done
	fi
fi

--
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux