github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/dev/hooks/pre-push (about)

     1  #!/bin/sh
     2  fail () {
     3      echo "pre-push hook: $@" >&2
     4      echo "    --no-verify to bypass this hook" >&2
     5      exit 1
     6  }
     7  
     8  # only push to oss when the enterprise version is absent
     9  # ====================
    10  oss="git@github.com:hashicorp/nomad.git"
    11  ent="git@github.com:hashicorp/nomad-enterprise.git"
    12  if [ "$2" != "$ent" -a -f version/version_ent.go ]; then
    13      fail "found enterprise version file version/version_ent.go while pushing to oss remote"
    14  fi
    15  
    16  # don't push to master, stable-*
    17  # ====================
    18  while read local_ref local_sha remote_ref remote_sha
    19  do
    20      if [ "$remote_ref" = "refs/heads/master" ]; then
    21  	fail "refusing to push directly to master"
    22      fi
    23  
    24      if echo "$remote_ref"|grep -q 'refs/heads/stable-.*'; then
    25  	fail "refusing to push directly to a branch prefixed \`stable-\`"
    26      fi
    27  done