{"id":2673,"url":"https://patchwork.libcamera.org/api/patches/2673/?format=json","web_url":"https://patchwork.libcamera.org/patch/2673/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200118035448.230530-7-nicolas@ndufresne.ca>","date":"2020-01-18T03:54:48","name":"[libcamera-devel,v3,6/6] checkstyle: Add a pre-commit hook script","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f7d0130e1312b771ade6e00924c80176bf7cd870","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/?format=json","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2673/mbox/","series":[{"id":635,"url":"https://patchwork.libcamera.org/api/series/635/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=635","date":"2020-01-18T03:54:42","name":"Add the ability to do pre-commit style check","version":3,"mbox":"https://patchwork.libcamera.org/series/635/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2673/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2673/checks/","tags":{},"headers":{"Return-Path":"<nicolas@ndufresne.ca>","Received":["from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 87434607AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 Jan 2020 05:00:05 +0100 (CET)","from nicolas-tpx395.localdomain (unknown\n\t[IPv6:2002:c0de:c115:0:66fc:8b:2a38:8313])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 66F50293B1A;\n\tSat, 18 Jan 2020 04:00:04 +0000 (GMT)"],"From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"libcamera-devel@lists.libcamera.org","Cc":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Date":"Fri, 17 Jan 2020 22:54:48 -0500","Message-Id":"<20200118035448.230530-7-nicolas@ndufresne.ca>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20200118035448.230530-1-nicolas@ndufresne.ca>","References":"<20200118035448.230530-1-nicolas@ndufresne.ca>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 6/6] checkstyle: Add a pre-commit hook\n\tscript","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":"Sat, 18 Jan 2020 04:00:05 -0000"},"content":"From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nThis adds support for pre-commit hook workflow. In pre-commit hook we\ncheck the style on the changes currently staged or the combination\nof the index and the last commit if \"git commit --amend\" is being used.\n\nSigned-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n utils/hooks/pre-commit | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)\n create mode 100755 utils/hooks/pre-commit","diff":"diff --git a/utils/hooks/pre-commit b/utils/hooks/pre-commit\nnew file mode 100755\nindex 0000000..7a5554d\n--- /dev/null\n+++ b/utils/hooks/pre-commit\n@@ -0,0 +1,17 @@\n+#!/bin/sh\n+\n+# Execute the checkstyle script after committing any code. This allows the\n+# commit to succeed, but ensures that the developer is aware of any potential\n+# issues immediately, and can resolve them and fix rapidly with:\n+#   git commit --amend\n+#\n+# To utilise this hook, install this file with:\n+#   cp utils/hooks/post-commit .git/hooks/post-commit\n+\n+args=\"--staged\"\n+if ps -ocommand= -p $PPID | grep -- \"--amend\"\n+then\n+   args=\"--amend\"\n+fi\n+\n+./utils/checkstyle.py $args\n","prefixes":["libcamera-devel","v3","6/6"]}