Skip to content
Snippets Groups Projects
Commit 3c01d12f authored by jurgenhaas's avatar jurgenhaas
Browse files

Fix post-checkout git hook

parent fdb2a03c
No related branches found
No related tags found
1 merge request!45Merging develop into main
......@@ -286,16 +286,10 @@ if [[ "${COMPOSE_PROJECT_NAME}" != "." ]]; then
echo "#!/bin/sh" > .git/hooks/post-checkout
chmod +x .git/hooks/post-checkout
fi
OLDCOMMAND='docker exec '${COMPOSE_PROJECT_NAME}'_'${USERNAME}'_l3d /usr/local/bin/update-env'
NEWCOMMAND='RUNNING=$(docker container ls --all -q -f name='${COMPOSE_PROJECT_NAME}'_'${USERNAME}_'l3d);if [ "x$RUNNING" != "x" ];then docker exec '${COMPOSE_PROJECT_NAME}'_l3d /usr/local/bin/update-env;fi'
OLD_HOOK_DEFINED=$(grep "$OLDCOMMAND" .git/hooks/post-checkout)
NEW_HOOK_DEFINED=$(grep "$NEWCOMMAND" .git/hooks/post-checkout)
if [[ "x$OLD_HOOK_DEFINED" = "x" ]]; then
echo "$NEWCOMMAND" >> .git/hooks/post-checkout
elif [[ "x$NEW_HOOK_DEFINED" = "x" ]]; then
OLDCOMMAND="${OLDCOMMAND//\//\\/}"
sed -i -e "/${OLDCOMMAND}/d" .git/hooks/post-checkout
echo "$NEWCOMMAND" >> .git/hooks/post-checkout
COMMAND='RUNNING=$(docker container ls --all -q -f name='${COMPOSE_PROJECT_NAME}'_'${USERNAME}'_l3d);if [ "x$RUNNING" != "x" ];then docker exec '${COMPOSE_PROJECT_NAME}'_'${USERNAME}'_l3d /usr/local/bin/update-env;fi'
HOOK_DEFINED=$(grep "$COMMAND" .git/hooks/post-checkout)
if [[ "x$HOOK_DEFINED" = "x" ]]; then
echo "$COMMAND" >> .git/hooks/post-checkout
fi
fi
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment