From patchwork Wed Sep 25 20:02:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1167682 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46dtGC1VPBz9sNk for ; Thu, 26 Sep 2019 08:36:50 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 40822E27; Wed, 25 Sep 2019 22:36:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 712F6CAE for ; Wed, 25 Sep 2019 22:36:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id BD3BC8D for ; Wed, 25 Sep 2019 22:36:46 +0000 (UTC) Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id A63AC100003; Wed, 25 Sep 2019 22:36:42 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Wed, 25 Sep 2019 13:02:31 -0700 Message-Id: <20190925200231.20712-1-blp@ovn.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] Documentation: Document a useful pre-push hook for committers. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Someone else wrote this script originally, I think, but I've extended it quite a bit. Signed-off-by: Ben Pfaff Reviewed-by: Simon Horman --- .../internals/committer-responsibilities.rst | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/Documentation/internals/committer-responsibilities.rst b/Documentation/internals/committer-responsibilities.rst index 4d10c3980875..c35fd708913b 100644 --- a/Documentation/internals/committer-responsibilities.rst +++ b/Documentation/internals/committer-responsibilities.rst @@ -94,3 +94,53 @@ Use Reported-by: and Tested-by: tags in commit messages to indicate the source of a bug report. Keep the ``AUTHORS.rst`` file up to date. + +Pre-Push Hook +------------- + +The following script can be helpful because it provides an extra +chance to check for mistakes while pushing to the master branch of OVS +or OVN. If you would like to use it, install it as ``hooks/pre-push`` +in your ``.git`` directory and make sure to mark it as executable with +``chmod +x``. For maximum utility, make sure ``checkpatch.py`` is in +``$PATH``: + +.. code-block:: bash + + #! /bin/bash + + remote=$1 + + case $remote in + ovs|ovn|origin) ;; + *) exit 0 ;; + esac + + while read local_ref local_sha1 remote_ref remote_sha1; do + case $remote_ref in + refs/heads/master) + n=0 + while read sha + do + n=$(expr $n + 1) + git log -1 $sha + echo + checkpatch.py -1 $sha + done < /dev/null; then + : + else + exit 1 + fi + ;; + esac + done + + exit 0