From 4c9690a35306a58858139be93ae5aac33efba2db Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 14 Jan 2026 15:13:14 +0100 Subject: [PATCH] Hooks: Rename directory and deny binary script (#20) To make it more consistent with other hook scripts and we also rename `docker-compose.yml` to `compose.yml` Reviewed-on: https://projects.blender.org/infrastructure/gitea-custom/pulls/20 --- {git-hooks => hooks}/.gitignore | 0 {git-hooks => hooks}/README.md | 12 ++++-------- {git-hooks => hooks}/blender_merge_hook | 0 git-hooks/docker-compose.yml => hooks/compose.yml | 0 git-hooks/deny-binary => hooks/deny_binary | 0 {git-hooks => hooks}/notice | 0 {git-hooks => hooks}/test/common/functions | 0 .../test/deny_binary/10_initial_text_file_test.sh | 2 +- .../test/deny_binary/11_add_text_file_test.sh | 2 +- .../test/deny_binary/20_initial_binary_file_test.sh | 2 +- .../test/deny_binary/21_add_binary_file_test.sh | 2 +- .../22_add_suspicious_binary_file_test.sh | 2 +- .../test/deny_binary/30_add_binary_lfs_file_test.sh | 2 +- .../40_add_binary_file_and_convert_test.sh | 2 +- .../50_migrate_legacy_file_to_lfs_test.sh | 2 +- .../deny_binary/51_move_legacy_file_with_binary.sh | 2 +- {git-hooks => hooks}/test/deny_binary/functions | 0 {git-hooks => hooks}/test/run_deny_binary_tests.sh | 0 18 files changed, 13 insertions(+), 17 deletions(-) rename {git-hooks => hooks}/.gitignore (100%) rename {git-hooks => hooks}/README.md (80%) rename {git-hooks => hooks}/blender_merge_hook (100%) rename git-hooks/docker-compose.yml => hooks/compose.yml (100%) rename git-hooks/deny-binary => hooks/deny_binary (100%) rename {git-hooks => hooks}/notice (100%) rename {git-hooks => hooks}/test/common/functions (100%) rename {git-hooks => hooks}/test/deny_binary/10_initial_text_file_test.sh (91%) rename {git-hooks => hooks}/test/deny_binary/11_add_text_file_test.sh (92%) rename {git-hooks => hooks}/test/deny_binary/20_initial_binary_file_test.sh (92%) rename {git-hooks => hooks}/test/deny_binary/21_add_binary_file_test.sh (93%) rename {git-hooks => hooks}/test/deny_binary/22_add_suspicious_binary_file_test.sh (94%) rename {git-hooks => hooks}/test/deny_binary/30_add_binary_lfs_file_test.sh (94%) rename {git-hooks => hooks}/test/deny_binary/40_add_binary_file_and_convert_test.sh (94%) rename {git-hooks => hooks}/test/deny_binary/50_migrate_legacy_file_to_lfs_test.sh (95%) rename {git-hooks => hooks}/test/deny_binary/51_move_legacy_file_with_binary.sh (94%) rename {git-hooks => hooks}/test/deny_binary/functions (100%) rename {git-hooks => hooks}/test/run_deny_binary_tests.sh (100%) diff --git a/git-hooks/.gitignore b/hooks/.gitignore similarity index 100% rename from git-hooks/.gitignore rename to hooks/.gitignore diff --git a/git-hooks/README.md b/hooks/README.md similarity index 80% rename from git-hooks/README.md rename to hooks/README.md index d9ba50f..b260909 100644 --- a/git-hooks/README.md +++ b/hooks/README.md @@ -2,7 +2,7 @@ ## Tests -For our `deny-binary` Git hook, we have several test cases. They can be run locally: +For our `deny_binary` Git hook, we have several test cases. They can be run locally: ```bash $ ./test/run_deny_binary_tests.sh @@ -19,15 +19,11 @@ Running 51_move_legacy_file_with_binary.sh... ok All tests passed. ``` -Or they can be run using the Gitea image to do end-to-end testing (see `docker-compose.yml` for changing the image). +Or they can be run using the Gitea image to do end-to-end testing (see `compose.yml` for changing the image). ```bash $ docker compose up -[+] Running 11/11 - ✔ gitea_deny_binary_tests Pulled -[+] Running 2/2 - ✔ Network git-hooks_default Created 0.0s - ✔ Container gitea_deny_binary_tests Created 0.2s +... Attaching to gitea_deny_binary_tests gitea_deny_binary_tests | == Running tests in directory deny_binary == gitea_deny_binary_tests | Running 10_initial_text_file_test.sh... ok @@ -65,7 +61,7 @@ The `blender_merged_hook` script rejects merge commits to branches were we don't ## Deny Binary Files -The `deny-binary` script rejects commit that add binary files that should have been tracked as Git LFS object instead. We also provide some tests, which can be run using Docker Compose inside our Gitea container image. It has been installed as a `pre-receive` hook in the following repositories: +The `deny_binary` script rejects commit that add binary files that should have been tracked as Git LFS object instead. We also provide some tests, which can be run using Docker Compose inside our Gitea container image. It has been installed as a `pre-receive` hook in the following repositories: - `blender/blender` - `blender/blender-assets` diff --git a/git-hooks/blender_merge_hook b/hooks/blender_merge_hook similarity index 100% rename from git-hooks/blender_merge_hook rename to hooks/blender_merge_hook diff --git a/git-hooks/docker-compose.yml b/hooks/compose.yml similarity index 100% rename from git-hooks/docker-compose.yml rename to hooks/compose.yml diff --git a/git-hooks/deny-binary b/hooks/deny_binary similarity index 100% rename from git-hooks/deny-binary rename to hooks/deny_binary diff --git a/git-hooks/notice b/hooks/notice similarity index 100% rename from git-hooks/notice rename to hooks/notice diff --git a/git-hooks/test/common/functions b/hooks/test/common/functions similarity index 100% rename from git-hooks/test/common/functions rename to hooks/test/common/functions diff --git a/git-hooks/test/deny_binary/10_initial_text_file_test.sh b/hooks/test/deny_binary/10_initial_text_file_test.sh similarity index 91% rename from git-hooks/test/deny_binary/10_initial_text_file_test.sh rename to hooks/test/deny_binary/10_initial_text_file_test.sh index f20dc43..c2abda9 100755 --- a/git-hooks/test/deny_binary/10_initial_text_file_test.sh +++ b/hooks/test/deny_binary/10_initial_text_file_test.sh @@ -17,7 +17,7 @@ setup_temp_git_identity ORIGIN_REPO_DIR=`setup_bare_origin_repository` WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt" git -C "${WORK_GIT_DIR}" add README.txt diff --git a/git-hooks/test/deny_binary/11_add_text_file_test.sh b/hooks/test/deny_binary/11_add_text_file_test.sh similarity index 92% rename from git-hooks/test/deny_binary/11_add_text_file_test.sh rename to hooks/test/deny_binary/11_add_text_file_test.sh index 0820f95..62a106b 100755 --- a/git-hooks/test/deny_binary/11_add_text_file_test.sh +++ b/hooks/test/deny_binary/11_add_text_file_test.sh @@ -17,7 +17,7 @@ setup_temp_git_identity ORIGIN_REPO_DIR=`setup_bare_origin_repository` WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt" git -C "${WORK_GIT_DIR}" add README.txt diff --git a/git-hooks/test/deny_binary/20_initial_binary_file_test.sh b/hooks/test/deny_binary/20_initial_binary_file_test.sh similarity index 92% rename from git-hooks/test/deny_binary/20_initial_binary_file_test.sh rename to hooks/test/deny_binary/20_initial_binary_file_test.sh index 1ea3b91..f6ece8f 100755 --- a/git-hooks/test/deny_binary/20_initial_binary_file_test.sh +++ b/hooks/test/deny_binary/20_initial_binary_file_test.sh @@ -18,7 +18,7 @@ setup_temp_git_identity ORIGIN_REPO_DIR=`setup_bare_origin_repository` WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" dd if=/dev/zero of="${WORK_GIT_DIR}/data.bin" bs=1 count=32k git -C "${WORK_GIT_DIR}" add data.bin diff --git a/git-hooks/test/deny_binary/21_add_binary_file_test.sh b/hooks/test/deny_binary/21_add_binary_file_test.sh similarity index 93% rename from git-hooks/test/deny_binary/21_add_binary_file_test.sh rename to hooks/test/deny_binary/21_add_binary_file_test.sh index 3cb00c1..272f2ed 100755 --- a/git-hooks/test/deny_binary/21_add_binary_file_test.sh +++ b/hooks/test/deny_binary/21_add_binary_file_test.sh @@ -17,7 +17,7 @@ setup_temp_git_identity ORIGIN_REPO_DIR=`setup_bare_origin_repository` WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt" git -C "${WORK_GIT_DIR}" add README.txt diff --git a/git-hooks/test/deny_binary/22_add_suspicious_binary_file_test.sh b/hooks/test/deny_binary/22_add_suspicious_binary_file_test.sh similarity index 94% rename from git-hooks/test/deny_binary/22_add_suspicious_binary_file_test.sh rename to hooks/test/deny_binary/22_add_suspicious_binary_file_test.sh index 1d999ee..33ccab2 100755 --- a/git-hooks/test/deny_binary/22_add_suspicious_binary_file_test.sh +++ b/hooks/test/deny_binary/22_add_suspicious_binary_file_test.sh @@ -16,7 +16,7 @@ setup_temp_git_identity ORIGIN_REPO_DIR=`setup_bare_origin_repository` WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt" git -C "${WORK_GIT_DIR}" add README.txt diff --git a/git-hooks/test/deny_binary/30_add_binary_lfs_file_test.sh b/hooks/test/deny_binary/30_add_binary_lfs_file_test.sh similarity index 94% rename from git-hooks/test/deny_binary/30_add_binary_lfs_file_test.sh rename to hooks/test/deny_binary/30_add_binary_lfs_file_test.sh index 8f2db6f..0359c1a 100755 --- a/git-hooks/test/deny_binary/30_add_binary_lfs_file_test.sh +++ b/hooks/test/deny_binary/30_add_binary_lfs_file_test.sh @@ -17,7 +17,7 @@ setup_temp_git_identity ORIGIN_REPO_DIR=`setup_bare_origin_repository` WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt" git -C "${WORK_GIT_DIR}" add README.txt diff --git a/git-hooks/test/deny_binary/40_add_binary_file_and_convert_test.sh b/hooks/test/deny_binary/40_add_binary_file_and_convert_test.sh similarity index 94% rename from git-hooks/test/deny_binary/40_add_binary_file_and_convert_test.sh rename to hooks/test/deny_binary/40_add_binary_file_and_convert_test.sh index c116852..514498b 100755 --- a/git-hooks/test/deny_binary/40_add_binary_file_and_convert_test.sh +++ b/hooks/test/deny_binary/40_add_binary_file_and_convert_test.sh @@ -18,7 +18,7 @@ setup_temp_git_identity ORIGIN_REPO_DIR=`setup_bare_origin_repository` WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt" git -C "${WORK_GIT_DIR}" add README.txt diff --git a/git-hooks/test/deny_binary/50_migrate_legacy_file_to_lfs_test.sh b/hooks/test/deny_binary/50_migrate_legacy_file_to_lfs_test.sh similarity index 95% rename from git-hooks/test/deny_binary/50_migrate_legacy_file_to_lfs_test.sh rename to hooks/test/deny_binary/50_migrate_legacy_file_to_lfs_test.sh index 0d06a67..5d65e21 100755 --- a/git-hooks/test/deny_binary/50_migrate_legacy_file_to_lfs_test.sh +++ b/hooks/test/deny_binary/50_migrate_legacy_file_to_lfs_test.sh @@ -33,7 +33,7 @@ if ! git -C "${WORK_GIT_DIR}" push; then exit 1 fi -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" git -C "${WORK_GIT_DIR}" lfs install git -C "${WORK_GIT_DIR}" lfs track "*.bin" diff --git a/git-hooks/test/deny_binary/51_move_legacy_file_with_binary.sh b/hooks/test/deny_binary/51_move_legacy_file_with_binary.sh similarity index 94% rename from git-hooks/test/deny_binary/51_move_legacy_file_with_binary.sh rename to hooks/test/deny_binary/51_move_legacy_file_with_binary.sh index 4bb2b17..a26bdbb 100755 --- a/git-hooks/test/deny_binary/51_move_legacy_file_with_binary.sh +++ b/hooks/test/deny_binary/51_move_legacy_file_with_binary.sh @@ -25,7 +25,7 @@ if ! git -C "${WORK_GIT_DIR}" push; then exit 1 fi -install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny-binary" "pre-receive" +install_hook "${ORIGIN_REPO_DIR}" "${SCRIPT_PATH}/../../deny_binary" "pre-receive" mkdir -p "${WORK_GIT_DIR}/bindata" git -C "${WORK_GIT_DIR}" mv data.bin bindata/data.bin diff --git a/git-hooks/test/deny_binary/functions b/hooks/test/deny_binary/functions similarity index 100% rename from git-hooks/test/deny_binary/functions rename to hooks/test/deny_binary/functions diff --git a/git-hooks/test/run_deny_binary_tests.sh b/hooks/test/run_deny_binary_tests.sh similarity index 100% rename from git-hooks/test/run_deny_binary_tests.sh rename to hooks/test/run_deny_binary_tests.sh