From b66ec8c19d1ca4ec7ceb2a915417696b3ac70604 Mon Sep 17 00:00:00 2001 From: petru Date: Tue, 19 May 2026 23:46:15 +0300 Subject: [PATCH] Modified - [scripts] [configure] [git-lfs] Added conditional Git LFS setup to `configure.sh` when repository LFS hooks are installed. - 1 - I updated `.configure.sh` so repositories that already have Git LFS hook scripts in `.git/hooks` now treat `git-lfs` as a required dependency during verification, install the `git-lfs` system package on supported package managers, and run `git lfs install --local` during non-verify setup. --- .codex-history.md | 3 +++ .configure.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/.codex-history.md b/.codex-history.md index d2d55a00e3..1bd24b5148 100644 --- a/.codex-history.md +++ b/.codex-history.md @@ -805,3 +805,6 @@ History search guidance: - 2 - I added a dedicated Darwin SQLite build path in `smart-build.sh` that routes macOS `bindata sqlite sqlite_unlock_notify` builds through `make release-darwin`, and I updated `Makefile` to make `release-darwin` configurable through `DARWIN_ARCHS` so helper scripts can request only `darwin-10.12/amd64` or `darwin-10.12/arm64`. - 3 - I hardened the Darwin SQLite flow in `smart-build.sh` for `code-server`-style containerized workspaces by distinguishing between a missing Docker CLI and an unreachable Docker daemon, by validating that the host Docker daemon can see the same mounted repository `go.mod` path as the current workspace, and by moving the temporary release output under `dist/` instead of `/tmp`. - 4 - I added `SMART_BUILD_DARWIN_HOST_REPO_PATH` support to `smart-build.sh` so Darwin SQLite builds can be redirected to a host-visible repository mount path when the interactive workspace path inside the container differs from the real host path used by the Docker daemon. + +161 - [2026-05-19 23:43:29] - v1.27.0-dev-172-g06e5bd7f46 - Type: Modified - [scripts] [configure] [git-lfs] Added conditional Git LFS setup to `configure.sh` when repository LFS hooks are installed. +- 1 - I updated `.configure.sh` so repositories that already have Git LFS hook scripts in `.git/hooks` now treat `git-lfs` as a required dependency during verification, install the `git-lfs` system package on supported package managers, and run `git lfs install --local` during non-verify setup. diff --git a/.configure.sh b/.configure.sh index 3e134f5eb2..d01dd1cb58 100755 --- a/.configure.sh +++ b/.configure.sh @@ -68,6 +68,7 @@ This script prepares the local machine for the Gitea build used in this tree. It can install or verify: - the required system build packages, including gcc, make, git, pkg-config, and the SQLite/PAM libraries; + - git-lfs when this repository has Git LFS hooks installed; - Go $GO_VERSION, as required by go.mod; - Node $NODE_VERSION and pnpm $PNPM_VERSION, as required by package.json; - frontend dependencies with pnpm install --frozen-lockfile; @@ -149,6 +150,21 @@ command_exists() { command -v "$1" >/dev/null 2>&1 } +repo_has_git_lfs_hooks() { + local hook + for hook in pre-push post-checkout post-commit post-merge; do + [ -f "$SCRIPT_DIR/.git/hooks/$hook" ] || continue + if grep -q 'git-lfs' "$SCRIPT_DIR/.git/hooks/$hook"; then + return 0 + fi + done + return 1 +} + +repo_requires_git_lfs() { + repo_has_git_lfs_hooks +} + run_as_root() { if [ "$(id -u)" -eq 0 ]; then "$@" @@ -227,6 +243,7 @@ install_system_packages() { xz-utils zip ) + repo_requires_git_lfs && packages+=(git-lfs) if [ "$WITH_CROSS_CGO" -eq 1 ]; then packages+=( gcc-arm-linux-gnueabihf @@ -267,6 +284,7 @@ install_system_packages() { xz zip ) + repo_requires_git_lfs && packages+=(git-lfs) run_as_root dnf install -y "${packages[@]}" [ "$WITH_CROSS_CGO" -eq 0 ] || warn "Cross-CGO package setup is only automated for apt-based systems." return @@ -299,6 +317,7 @@ install_system_packages() { xz zip ) + repo_requires_git_lfs && packages+=(git-lfs) run_as_root yum install -y "${packages[@]}" [ "$WITH_CROSS_CGO" -eq 0 ] || warn "Cross-CGO package setup is only automated for apt-based systems." return @@ -329,6 +348,7 @@ install_system_packages() { xz zip ) + repo_requires_git_lfs && packages+=(git-lfs) run_as_root pacman -Sy --needed --noconfirm "${packages[@]}" [ "$WITH_CROSS_CGO" -eq 0 ] || warn "Cross-CGO package setup is only automated for apt-based systems." return @@ -361,6 +381,7 @@ install_system_packages() { xz zip ) + repo_requires_git_lfs && packages+=(git-lfs) run_as_root zypper install -y "${packages[@]}" [ "$WITH_CROSS_CGO" -eq 0 ] || warn "Cross-CGO package setup is only automated for apt-based systems." return @@ -484,6 +505,16 @@ install_frontend_deps() { pnpm install --frozen-lockfile } +configure_git_lfs() { + repo_requires_git_lfs || return + + log "Configuring Git LFS" + command_exists git-lfs || die "git-lfs is required for this repository but is not installed." + + cd "$SCRIPT_DIR" + git lfs install --local >/dev/null +} + configure_cross_cgo() { [ "$WITH_CROSS_CGO" -eq 1 ] || return @@ -528,6 +559,9 @@ verify_environment() { missing+=("$command_name") fi done + if repo_requires_git_lfs && ! command_exists git-lfs; then + missing+=("git-lfs") + fi if command_exists go; then local found_go @@ -592,6 +626,9 @@ verify_environment() { printf 'Node: %s\n' "$(node --version)" printf 'pnpm: %s\n' "$(pnpm --version)" printf 'gcc: %s\n' "$(gcc --version | head -n 1)" + if repo_requires_git_lfs; then + printf 'git-lfs: %s\n' "$(git lfs version)" + fi if [ -d "$SCRIPT_DIR/node_modules" ]; then printf 'node_modules: present\n' else @@ -652,6 +689,7 @@ fi if [ "$VERIFY_ONLY" -eq 0 ]; then [ "$INSTALL_SYSTEM" -eq 0 ] || install_system_packages + configure_git_lfs [ "$INSTALL_GO" -eq 0 ] || install_go [ "$INSTALL_NODE" -eq 0 ] || install_node_and_pnpm configure_cross_cgo