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
This commit is contained in:
Bart van der Braak
2026-01-14 15:13:14 +01:00
parent 2d2d1db041
commit 4c9690a353
18 changed files with 13 additions and 17 deletions

View File

@@ -2,7 +2,7 @@
## Tests ## 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 ```bash
$ ./test/run_deny_binary_tests.sh $ ./test/run_deny_binary_tests.sh
@@ -19,15 +19,11 @@ Running 51_move_legacy_file_with_binary.sh... ok
All tests passed. 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 ```bash
$ docker compose up $ 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 Attaching to gitea_deny_binary_tests
gitea_deny_binary_tests | == Running tests in directory deny_binary == gitea_deny_binary_tests | == Running tests in directory deny_binary ==
gitea_deny_binary_tests | Running 10_initial_text_file_test.sh... ok 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 ## 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`
- `blender/blender-assets` - `blender/blender-assets`

View File

@@ -17,7 +17,7 @@ setup_temp_git_identity
ORIGIN_REPO_DIR=`setup_bare_origin_repository` ORIGIN_REPO_DIR=`setup_bare_origin_repository`
WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` 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" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt"
git -C "${WORK_GIT_DIR}" add README.txt git -C "${WORK_GIT_DIR}" add README.txt

View File

@@ -17,7 +17,7 @@ setup_temp_git_identity
ORIGIN_REPO_DIR=`setup_bare_origin_repository` ORIGIN_REPO_DIR=`setup_bare_origin_repository`
WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` 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" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt"
git -C "${WORK_GIT_DIR}" add README.txt git -C "${WORK_GIT_DIR}" add README.txt

View File

@@ -18,7 +18,7 @@ setup_temp_git_identity
ORIGIN_REPO_DIR=`setup_bare_origin_repository` ORIGIN_REPO_DIR=`setup_bare_origin_repository`
WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` 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 dd if=/dev/zero of="${WORK_GIT_DIR}/data.bin" bs=1 count=32k
git -C "${WORK_GIT_DIR}" add data.bin git -C "${WORK_GIT_DIR}" add data.bin

View File

@@ -17,7 +17,7 @@ setup_temp_git_identity
ORIGIN_REPO_DIR=`setup_bare_origin_repository` ORIGIN_REPO_DIR=`setup_bare_origin_repository`
WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` 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" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt"
git -C "${WORK_GIT_DIR}" add README.txt git -C "${WORK_GIT_DIR}" add README.txt

View File

@@ -16,7 +16,7 @@ setup_temp_git_identity
ORIGIN_REPO_DIR=`setup_bare_origin_repository` ORIGIN_REPO_DIR=`setup_bare_origin_repository`
WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` 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" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt"
git -C "${WORK_GIT_DIR}" add README.txt git -C "${WORK_GIT_DIR}" add README.txt

View File

@@ -17,7 +17,7 @@ setup_temp_git_identity
ORIGIN_REPO_DIR=`setup_bare_origin_repository` ORIGIN_REPO_DIR=`setup_bare_origin_repository`
WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` 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" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt"
git -C "${WORK_GIT_DIR}" add README.txt git -C "${WORK_GIT_DIR}" add README.txt

View File

@@ -18,7 +18,7 @@ setup_temp_git_identity
ORIGIN_REPO_DIR=`setup_bare_origin_repository` ORIGIN_REPO_DIR=`setup_bare_origin_repository`
WORK_GIT_DIR=`clone_repository "${ORIGIN_REPO_DIR}"` 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" echo "Hello, World!" > "${WORK_GIT_DIR}/README.txt"
git -C "${WORK_GIT_DIR}" add README.txt git -C "${WORK_GIT_DIR}" add README.txt

View File

@@ -33,7 +33,7 @@ if ! git -C "${WORK_GIT_DIR}" push; then
exit 1 exit 1
fi 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 install
git -C "${WORK_GIT_DIR}" lfs track "*.bin" git -C "${WORK_GIT_DIR}" lfs track "*.bin"

View File

@@ -25,7 +25,7 @@ if ! git -C "${WORK_GIT_DIR}" push; then
exit 1 exit 1
fi 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" mkdir -p "${WORK_GIT_DIR}/bindata"
git -C "${WORK_GIT_DIR}" mv data.bin bindata/data.bin git -C "${WORK_GIT_DIR}" mv data.bin bindata/data.bin