Sfoglia il codice sorgente

Call pre-commit hook from pre-push script

rl1987 5 anni fa
parent
commit
705c1c28c7
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      scripts/git/pre-push.git-hook

+ 7 - 0
scripts/git/pre-push.git-hook

@@ -27,6 +27,13 @@ ref_is_upstream_branch() {
         fi
 }
 
+workdir=$(git rev-parse --show-toplevel)
+if [ -x "$workdir/.git/hooks/pre-commit" ]; then
+  if ! "$workdir"/.git/hooks/pre-commit; then
+    exit 1
+  fi
+fi
+
 # shellcheck disable=SC2034
 while read -r local_ref local_sha remote_ref remote_sha
 do