From nobody Tue Aug 23 13:08:57 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MBqLK6GGpz4ZcmH; Tue, 23 Aug 2022 13:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MBqLK5mdFz44XG; Tue, 23 Aug 2022 13:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661260137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G6LmfGIuZJd1BbH2O7tNS+6EDpo6rApRIYFaMxtuJ4k=; b=pyjzBP9DBMX1b6X4AQRXosHd5vb1cYWBI50k7+9QPnOOF479N6aWfSQ8lQt+gfczA4TQ2A dTwI71rfgIhJvXbLjacZWEwbrXQ+sR7vcHLkcc/DsKlnhyT1VjourIg2YSctoCep0wnS2S Bj/vZXxLfK28jMD2TMb8YnK/maYZIpJwdvl5DLdeG/1qsrZwtgk/9tgG7C7WrL28jDBNuU fYa1DqFJRZMD/QqACllYakt1E0Pz9gFPEVSnP5wZyT7w3bRIUgF8/S1E31JcjVX7U3BY53 /uUgpCKKlSvFRZzC1RgpvwQ0nILHYCBgDGMpiNK2Uc5mwCf3fh3qMxhPMDpfig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MBqLK4nJqzWPl; Tue, 23 Aug 2022 13:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27ND8vFL001540; Tue, 23 Aug 2022 13:08:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27ND8vP4001539; Tue, 23 Aug 2022 13:08:57 GMT (envelope-from git) Date: Tue, 23 Aug 2022 13:08:57 GMT Message-Id: <202208231308.27ND8vP4001539@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: "Tobias C. Berner" Subject: git: 951773c013b9 - main - framework: add new hook to validate MOVED lines List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tcberner X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 951773c013b9bfc73bba33617757660ddc34ebce Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661260137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G6LmfGIuZJd1BbH2O7tNS+6EDpo6rApRIYFaMxtuJ4k=; b=ThKRHwEzQdDoJ2xUrskgqvGoqOlPO7pxByQPxjQ0DeTae3NCD5rd1NzSdpt/YRXl8fqw83 6N76ODwa4+KNP1FsqKn9CSock+dh2or9dBvvSIE/iilcNXS3xVlJLOESHUE5wfxGiAyPA5 mR6+cC0MgfBJenxLkm2+Qu2z11q2MRx22kKmehgJCm5yDIxbgQaSqN0ME0ljU0+CH01tT5 4vA8EIR7Hs8YS1NNVTL+VhHl1TyRfpySJc2kIQx1xZ4fYfBpAVh/IZmrALJBnPCcgKQLWw PO/UBWPTDPjYhW/5JH+2QTrDWfqzmULAHyERzNFQwUoEtBD0TLxWkPrXXBQ2iA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661260137; a=rsa-sha256; cv=none; b=ooxpn4rNB4qS71PKEDEQr5KMiAnKdg5U3Spsm/fhyGCeJlmfaN9x9aZrxPhwZLqjBrwll7 04ztiZ4zRxTsjNWDky+K1NddPq8mVR6/feJWSD6PHSdr9B6lG+suf54Bo2pZHPA6KtrQWj Ex296DS7AuwKL8iqZANPbwbmRh26beqwfIdATLCCAZDxURJ0bb8FohhKhE93pMcVa8RVDy TECtfeV036BUhbIyAl/O1vLTvz2VwQn6YxRdTmPCMlDyZZa9zl9ZvCN99A1PrdBnuAAzR0 x1i8zv3rLClxbsEHf0FeupGFs5eMSq/CW07l374pK0yOCFciaEboNykVk/60ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tcberner: URL: https://cgit.FreeBSD.org/ports/commit/?id=951773c013b9bfc73bba33617757660ddc34ebce commit 951773c013b9bfc73bba33617757660ddc34ebce Author: Tobias C. Berner AuthorDate: 2022-08-23 13:01:59 +0000 Commit: Tobias C. Berner CommitDate: 2022-08-23 13:08:11 +0000 framework: add new hook to validate MOVED lines A possible error message will look like: [pre-commit] ERROR: MOVED contains errors. Please apply the suggested changes: 17537: date going backwards from 2022-08-20 to 2022-08-13 from this line 17538: date going backwards from 2022-08-20 to 2022-08-13 to this line Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D35042 --- .hooks/pre-commit.d/check_moved | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.hooks/pre-commit.d/check_moved b/.hooks/pre-commit.d/check_moved new file mode 100755 index 000000000000..3d6a3209aef0 --- /dev/null +++ b/.hooks/pre-commit.d/check_moved @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Check that newly added MOVED lines are valid +# + + +moved_changed=$(git diff --name-only --cached --diff-filter=M | grep -E '^MOVED$') +if [ $? -eq 0 ] ; then + # git changes to root directory of the tree to run hooks + tree=$(git rev-parse --show-toplevel) + # check the last seven days + lastdate=$(date -v-7d "+%Y-%m-%d") + + errors=$(PORTSDIR=${tree} Tools/scripts/MOVEDlint.awk -v lastdate="${lastdate}") + if [ $? -ne 0 ] ; then + echo -e "[pre-commit] ERROR: MOVED contains errors.\n" \ + " Please apply the suggested changes:\n" + echo "${errors}" + exit 1 + fi +fi