瀏覽代碼

Call pre-commit hook from pre-push script

rl1987 5 年之前
父節點
當前提交
705c1c28c7
共有 1 個文件被更改,包括 7 次插入0 次删除
  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