From nobody Fri May 3 12:30:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15166233734771012.3329217576174; Mon, 22 Jan 2018 04:16:13 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 169985D68B; Mon, 22 Jan 2018 12:16:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B6F0983F; Mon, 22 Jan 2018 12:16:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 046571800BD3; Mon, 22 Jan 2018 12:16:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0MC5SDx006035 for ; Mon, 22 Jan 2018 07:05:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8C91F9065; Mon, 22 Jan 2018 12:05:28 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5025811E1; Mon, 22 Jan 2018 12:05:27 +0000 (UTC) From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Mon, 22 Jan 2018 12:05:19 +0000 Message-Id: <20180122120519.23908-2-berrange@redhat.com> In-Reply-To: <20180122120519.23908-1-berrange@redhat.com> References: <20180122120519.23908-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH hooks 1/1] Add check for Signed-off-by in commit messages X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 22 Jan 2018 12:16:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: John Ferlan --- update | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/update b/update index 6a8edcb..b7cfe7f 100755 --- a/update +++ b/update @@ -248,7 +248,21 @@ if [ $check_diff =3D yes ]; then if [ "$allow_bad_whitespace" !=3D "true" ]; then test "$oldrev" =3D $zero \ && exit 0 - exec git diff --check $oldrev $newrev -- + git diff --check $oldrev $newrev -- + test $? !=3D 0 && exit 1 + fi + + allow_missing_sob=3D$(git config --bool hooks.allowmissingsob) + if [ "$allow_missing_sob" !=3D "true" ]; then + for rev in `git log --format=3D%h $oldrev..$newrev` + do + git show $rev | grep Signed-off-by >/dev/null 2>&1 + if test $? !=3D 0 + then + echo "*** Update hook: missing Signed-off-by tag in $rev" >&2 + exit 1 + fi + done fi fi =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list