Patch Detail
Show a patch.
GET /api/patches/3550/?format=api
{ "id": 3550, "url": "https://patchwork.libcamera.org/api/patches/3550/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3550/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200426222323.17245-1-laurent.pinchart@ideasonboard.com>", "date": "2020-04-26T22:23:23", "name": "[libcamera-devel] utils: hooks: pre-push: Catch commits without committer's SoB", "commit_ref": "fcfbec801bab520bcbb246f38f8efc448c901946", "pull_url": null, "state": "accepted", "archived": false, "hash": "e3129756670e41b5528c12462b1934139e46bce1", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3550/mbox/", "series": [ { "id": 829, "url": "https://patchwork.libcamera.org/api/series/829/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=829", "date": "2020-04-26T22:23:23", "name": "[libcamera-devel] utils: hooks: pre-push: Catch commits without committer's SoB", "version": 1, "mbox": "https://patchwork.libcamera.org/series/829/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3550/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3550/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AC0A4603FC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 00:23:41 +0200 (CEST)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2D4044F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 00:23:41 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"NvQeCTmh\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1587939821;\n\tbh=Mb8VBFapOHziM9sQ9i2/35gxgh/cCY0C1r9Qk7BWgjE=;\n\th=From:To:Subject:Date:From;\n\tb=NvQeCTmhhzA0EJdRCxvoLbLt8PcxuFAAkvUSQYYxYGq4TR6l+XzG0HLHdvHdlguvd\n\tgIgWuNgGvxDwdBI97cjhPqx5DMWKgzlR4AzFWQVF0AcX9crfl6Qiisxs5/CQCVhi77\n\tl/cLofh2NUVlddfqihI1pbZvfcbdLxHA5/Acwzss=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 27 Apr 2020 01:23:23 +0300", "Message-Id": "<20200426222323.17245-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.25.3", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] utils: hooks: pre-push: Catch commits\n\twithout committer's SoB", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "X-List-Received-Date": "Sun, 26 Apr 2020 22:23:41 -0000" }, "content": "Improve the pre-push git hook script to reject commits without the\ncommitter's Signed-off-by line.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/hooks/pre-push | 31 +++++++++++++++++++++++++++----\n 1 file changed, 27 insertions(+), 4 deletions(-)", "diff": "diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push\nindex 34906ddee5ed..0eb8f5ce193d 100755\n--- a/utils/hooks/pre-push\n+++ b/utils/hooks/pre-push\n@@ -32,12 +32,35 @@ do\n \t\trange=\"$remote_sha..$local_sha\"\n \tfi\n \n+\t#\n \t# Find invalid commits.\n-\tcommit=$(git rev-list -n 1 --grep '^---' \"$range\")\n-\tif [ -n \"$commit\" ]\n+\t#\n+\terrors=0\n+\tfor commit in $(git rev-list \"$range\")\n+\tdo\n+\t\tmsg=$(git cat-file commit \"$commit\")\n+\n+\t\t# 1. The commit message shall not contain a local changelog.\n+\t\tif echo \"$msg\" | grep -q '^--- *$'\n+\t\tthen\n+\t\t\techo >&2 \"Found local changelog in commit $commit\"\n+\t\t\terrors=$((errors+1))\n+\t\tfi\n+\n+\t\t# 2. The commit message shall have a Signed-off-by line\n+\t\t# corresponding the committer.\n+\t\tcommitter=$(echo \"$msg\" | grep '^committer ' | head -1 | \\\n+\t\t\t\tcut -d ' ' -f 2- | rev | cut -d ' ' -f 3- | rev)\n+\t\tif ! echo \"$msg\" | grep -F -q \"Signed-off-by: ${committer}\"\n+\t\tthen\n+\t\t\techo >&2 \"Missing committer Signed-off-by in commit $commit\"\n+\t\t\terrors=$((errors+1))\n+\t\tfi\n+\tdone\n+\n+\tif [ $errors != 0 ]\n \tthen\n-\t\techo >&2 \"Found local changelog in $local_ref, not pushing\"\n-\t\techo >&2 \"Check commit $commit\"\n+\t\techo >&2 \"Found $errors errors in $local_ref, not pushing\"\n \t\texit 1\n \tfi\n done\n", "prefixes": [ "libcamera-devel" ] }