From 8be5d22a4dc69c7031b11df669ae26152730baba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 1 Jun 2026 10:46:26 +0200 Subject: [PATCH 1/2] chore: Add pre-commit hook to make sure to not push updater.phar with a dirty version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When git status is not clean "dirty" gets added in lib/Version.php and that makes the check-same-code check to fail on updater.phar This adds a pre-commit hook to detect that locally before pushing. Also added php-lint and cs-fixer hooks. Signed-off-by: Côme Chilliet --- .php-cs-fixer.dist.php | 2 +- .pre-commit-config.yaml | 25 +++++++++++++++++++++++++ tests/checkPharForDirtyVersion.sh | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml create mode 100755 tests/checkPharForDirtyVersion.sh diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b3a582b9..2cfdc216 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -7,7 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -require_once __DIR__.'/vendor-bin/coding-standard/vendor/autoload.php'; +require_once __DIR__ . '/vendor-bin/coding-standard/vendor/autoload.php'; use Nextcloud\CodingStandard\Config; diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..40088d53 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +# SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/nextcloud/pre-commit-php.git + rev: 1.5.1 + hooks: + - id: php-lint + - id: php-cs-fixer + files: \.(php)$ + exclude: ^(vendor|vendor-bin) + args: [] +- repo: local + hooks: + - id: check-dirty-version + name: Check updater.phar for dirty version + entry: tests/checkPharForDirtyVersion.sh + language: script + files: ^updater.phar$ diff --git a/tests/checkPharForDirtyVersion.sh b/tests/checkPharForDirtyVersion.sh new file mode 100755 index 00000000..25423c7d --- /dev/null +++ b/tests/checkPharForDirtyVersion.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +grep --text "class Version {" -A3 updater.phar | grep -v dirty From 4ce3a2d211560671bda2d0d9fa480520766499b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 1 Jun 2026 11:05:40 +0200 Subject: [PATCH 2/2] chore: Add missing license in checkPharForDirtyVersion.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- tests/checkPharForDirtyVersion.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/checkPharForDirtyVersion.sh b/tests/checkPharForDirtyVersion.sh index 25423c7d..e68ccbf0 100755 --- a/tests/checkPharForDirtyVersion.sh +++ b/tests/checkPharForDirtyVersion.sh @@ -1,3 +1,6 @@ #!/bin/sh +# +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: AGPL-3.0-or-later grep --text "class Version {" -A3 updater.phar | grep -v dirty