From ec9181921b8541ca2117a5a3773ed1ed23110082 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Tue, 28 Mar 2023 12:13:16 +0200 Subject: [PATCH] Fixed preventing git submodules from being committed - because we now ignore git submodule changes, they didn't show up in `git diff --cached...`, so it was possible to get submodules to be committed - you can re-enable submodules to be shown with `--ignore-submodules=none` - this implements that - we never want to allow submodules to be committed, so I've removed the prompt for faster feedback --- .github/hooks/pre-commit | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit index 733792bd8c..3226992868 100755 --- a/.github/hooks/pre-commit +++ b/.github/hooks/pre-commit @@ -17,11 +17,11 @@ fi green='\033[0;32m' no_color='\033[0m' grey='\033[0;90m' - +red='\033[0;31m' ROOT_DIR=$(git rev-parse --show-cdup) SUBMODULES=$(grep path ${ROOT_DIR}.gitmodules | sed 's/^.*path = //') -MOD_SUBMODULES=$(git diff --cached --name-only | grep -F "$SUBMODULES") +MOD_SUBMODULES=$(git diff --cached --name-only --ignore-submodules=none | grep -F "$SUBMODULES") echo -e "Checking submodules ${grey}(pre-commit hook)${no_color} " @@ -37,16 +37,8 @@ if [[ -n "$MOD_SUBMODULES" ]]; then echo -e "\t${green}modified:\t$SUB${no_color}" done echo - echo -n -e "Continue with commit? ${grey}(N|y)${no_color} " - read -n 1 reply