From dc64ec527c2f5056d28cfef246769e68dcedea2a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 29 May 2026 11:45:34 +0900 Subject: [PATCH] build: Ensure the installed pre-push git hook matches its source. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Makefile.am ($(GIT_HOOKS_DIR)/pre-push): Make a phony target, and copy file when the target differs from its prerequisite. Fixes: #7645 Reported-by: Gábor Udvari Change-Id: I6b5f677afe59c25a4d8905da814af4bbd91fb401 --- Makefile.am | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile.am b/Makefile.am index 79575c7dfdb..d349fcaa383 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1281,6 +1281,14 @@ $(GIT_HOOKS_DIR): $(GIT_HOOKS_DIR)/%: etc/git/% | $(GIT_HOOKS_DIR)/ if [ -n "$(GIT_HOOKS_DIR)" ]; then cp "$<" "$@"; fi +# Special-case the pre-push hook installation, to ensure it is always +# up-to-date with its source. +.PHONY: $(GIT_HOOKS_DIR)/pre-push +$(GIT_HOOKS_DIR)/pre-push: etc/git/pre-push | $(GIT_HOOKS_DIR) + @if [ -n "$(GIT_HOOKS_DIR)" ]; then \ + cmp "--silent" "$<" "$@" || cp "$<" "$@"; \ + fi + $(GIT_CONFIG_FILE): etc/git/gitconfig if [ -n "$(GIT_CONFIG_FILE)" ]; then \ git config --fixed-value --replace-all include.path \