From 940058c78acb4b8b0b1c0bb8b10e3ee8a54e5059 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Mon, 24 Aug 2026 21:24:07 +0200 Subject: [PATCH] Keep git-lfs's own hooks, now that the hook path is ours MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `core.hooksPath` points at `.githooks` for the traceability hook, and that redirects *every* hook — including the four git-lfs installs for itself. They were written there by `git lfs install` and left untracked, which is the worst of both: present for whoever ran it, absent for everyone else. `pre-push` is the one that matters. It is what uploads LFS objects, so without it a push can land a pointer on the server with nothing behind it — which is exactly the failure CI has been hitting from the other side, and not a state to risk creating by accident. Committed rather than regenerated per clone, because `git lfs install` writes to `.git/hooks` by default and would miss the redirect entirely. Co-Authored-By: Claude Opus 5 (1M context) --- .githooks/post-checkout | 3 +++ .githooks/post-commit | 3 +++ .githooks/post-merge | 3 +++ .githooks/pre-push | 3 +++ 4 files changed, 12 insertions(+) create mode 100755 .githooks/post-checkout create mode 100755 .githooks/post-commit create mode 100755 .githooks/post-merge create mode 100755 .githooks/pre-push diff --git a/.githooks/post-checkout b/.githooks/post-checkout new file mode 100755 index 0000000..5abf8ed --- /dev/null +++ b/.githooks/post-checkout @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs post-checkout "$@" diff --git a/.githooks/post-commit b/.githooks/post-commit new file mode 100755 index 0000000..b8b76c2 --- /dev/null +++ b/.githooks/post-commit @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs post-commit "$@" diff --git a/.githooks/post-merge b/.githooks/post-merge new file mode 100755 index 0000000..726f909 --- /dev/null +++ b/.githooks/post-merge @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs post-merge "$@" diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 0000000..5f26dc4 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,3 @@ +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { printf >&2 "\n%s\n\n" "This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks')."; exit 2; } +git lfs pre-push "$@"