From fd1a9a8f22851d18441a41eefbc1a30ddb95f421 Mon Sep 17 00:00:00 2001 From: ArmandBahi <armand.bahi@veremes.com> Date: Thu, 27 Sep 2018 16:48:56 +0200 Subject: [PATCH] Automaticaly copy git hooks --- utils/copy_hooks.sh | 5 ++--- utils/{pre-push => githooks/post-merge} | 5 +++-- utils/githooks/pre-push | 21 +++++++++++++++++++++ utils/post-merge | 17 ----------------- 4 files changed, 26 insertions(+), 22 deletions(-) rename utils/{pre-push => githooks/post-merge} (55%) create mode 100755 utils/githooks/pre-push delete mode 100755 utils/post-merge diff --git a/utils/copy_hooks.sh b/utils/copy_hooks.sh index b27313e7..f5bed2f2 100755 --- a/utils/copy_hooks.sh +++ b/utils/copy_hooks.sh @@ -7,9 +7,8 @@ # -if [ "post-merge" ]; then +if [ -d "githooks" ]; then if [ -d "../.git/hooks" ]; then - cp -f post-merge ../.git/hooks/post-merge - cp -f pre-push ../.git/hooks/pre-push + cp -f githooks/* ../.git/hooks/ fi fi diff --git a/utils/pre-push b/utils/githooks/post-merge similarity index 55% rename from utils/pre-push rename to utils/githooks/post-merge index cb67b173..548e6ae5 100755 --- a/utils/pre-push +++ b/utils/githooks/post-merge @@ -1,6 +1,6 @@ #!/bin/sh # -# Hook qui permet de mettre à jour toutes les dépendances +# Hook qui permet de pull toutes les dépendances # quand on fait un pull sur l'application # # @@ -8,7 +8,8 @@ # # -echo "****** Pre-push Hook ******" +echo "****** Post-merge Hook ******" +echo "****** Pull subtrees ******" echo "$(pwd)" if [ -d "$(pwd)/utils" ]; then diff --git a/utils/githooks/pre-push b/utils/githooks/pre-push new file mode 100755 index 00000000..50401f9e --- /dev/null +++ b/utils/githooks/pre-push @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Hook qui permet de push toutes les dépendances +# quand on fait un push sur l'application +# +# +# +# +# + +remote="$1" +url="$2" +if [ $remote != $url ]; then + + echo "****** Pre-push Hook ******" + echo "****** Push subtrees ******" + if [ -d "$(pwd)/utils" ]; then + cd utils + ./push_subtrees.sh + fi +fi diff --git a/utils/post-merge b/utils/post-merge deleted file mode 100755 index eaedfb0b..00000000 --- a/utils/post-merge +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# -# Hook qui permet de push toutes les dépendances -# quand on fait un push sur l'application -# -# -# -# -# - -echo "****** Post-merge Hook ******" -echo "$(pwd)" - -if [ -d "$(pwd)/utils" ]; then - cd utils - ./push_subtrees.sh -fi -- GitLab