[Git][security-tracker-team/security-tracker][master] Make setup-repo work with submodules

Emilio Pozuelo Monfort (@pochu) pochu at debian.org
Wed Jun 22 10:29:59 BST 2022



Emilio Pozuelo Monfort pushed to branch master at Debian Security Tracker / security-tracker


Commits:
fda71b54 by Enrico Zini at 2022-06-22T11:29:03+02:00
Make setup-repo work with submodules

- - - - -


1 changed file:

- bin/setup-repo


Changes:

=====================================
bin/setup-repo
=====================================
@@ -4,8 +4,19 @@
 
 set -e
 
-SRC=../../conf/pre-commit
-HOOK=.git/hooks/pre-commit
+## variables
+if [ -d .git ]; then
+  GIT_HOOKS_DIR=".git/hooks"
+elif [ -e .git ]; then
+  GIT_DIR=$(awk '/gitdir:/ { print $2 }' .git)
+  GIT_HOOKS_DIR="$GIT_DIR/hooks"
+else
+  echo "ERROR: Not in the top-level directory of the git repository." >&2
+  exit 1
+fi
+
+SRC=$(realpath --relative-to "$GIT_HOOKS_DIR" conf/pre-commit)
+HOOK="$GIT_HOOKS_DIR"/pre-commit
 
 install_pre_commit_hook() {
   if [ -L "${HOOK}" ] && [ "$(readlink ${HOOK})" = "${SRC}" ]; then



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/commit/fda71b541d09689c6f5a8ae7807321186d5f722f

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/commit/fda71b541d09689c6f5a8ae7807321186d5f722f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20220622/8b65bc0a/attachment-0001.htm>


More information about the debian-security-tracker-commits mailing list