From 32e9ca423ec7d7394ea30e2006f403301b0ea04d Mon Sep 17 00:00:00 2001 From: Achill Gilgenast Date: Fri, 19 Dec 2025 15:34:56 +0100 Subject: [PATCH] githooks/pre-commit: remove file size check This still comes from the aports hook, where we want to avoid too large patches, but in pmaports we have big kernel config files that might exceed the configured 256 kiB limit. Currently the following files exceed that limit and used git commit --no-verify to overcome the error (or didn't configure git hooks): 260K ./device/community/linux-postmarketos-qcom-laptop/config-postmarketos-qcom-laptop.aarch64 268K ./main/postmarketos-bootsplash/OpenSans-Regular.svg 336K ./device/downstream/linux-amazon-checkers/0003-Add-missing-kconfig-files.patch 376K ./device/downstream/linux-amazon-austin/silence-power-logspam.patch Alternatively we can increase the file limit, but i'm not sure what that solves. In future for Alpine, I want to move the check to abuild's internal linting, which makes it visible for all APKBUILDs, consistent with other of abuild's linters and also shows up on CI. Part-of: --- .githooks/pre-commit | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 8dd60c0f5..6bbfd1f9b 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -5,10 +5,6 @@ # set -eu -# Maximal allowed size (in bytes) of a file. -FILE_SIZE_LIMIT=262144 # 256 kiB - - if ! command -v sha512sum >/dev/null; then # macOS / BSDs (?) don't have sha512sum, but shasum. alias sha512sum='shasum -a 512' @@ -95,20 +91,6 @@ check_local_sources() { return $status } -# Checks if the file ($1) being committed is not bigger than FILE_SIZE_LIMIT. -check_file_size() { - local path="$1" - local size - - size=$(git cat-file -s ":$path") - if [ $size -gt $FILE_SIZE_LIMIT ]; then - local size_kb=$(( size / 1024 )) - - error "file \"$path\" is quite big ($(( size / 1024 )) kiB), better put a remote url in source=" - return 1 - fi -} - cleanup() { [ -f "$_staged" ] && rm "$_staged" } @@ -122,8 +104,4 @@ for apkbuild in $(changed_files '**/APKBUILD'); do cleanup done -for path in $(changed_files); do - check_file_size "$path" -done - trap - EXIT