daml/dev-env/git-hooks/pre-push
Gary Verhaegen 93f449d245
rename master to main (#8245)
As we strive for more inclusiveness, we are becoming less comfortable
with historically-charged terms being used in our everyday work.

This is targeted for merge on Dec 26, _after_ the necessary
corresponding changes at both the GitHub and Azure Pipelines levels.

CHANGELOG_BEGIN

- DAML Connect development is now conducted from the `main` branch,
  rather than the `master` one. If you had any dependency on the
  digital-asset/daml repository, you will need to update this parameter.

CHANGELOG_END
2020-12-27 14:19:07 +01:00

32 lines
861 B
Bash
Executable File

#!/usr/bin/env bash
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local sha1> <remote ref> <remote sha1>
#
protected_branches=('main')
IFS=' '
while read local_ref local_sha remote_ref remote_sha
do
for protected_branch in "${protected_branches[@]}"; do
if [[ $remote_ref == "refs/heads/$protected_branch" ]]; then
echo -en "\033[31mYou're about to push main, that is verboten!\033[0m"
echo
exit 1 # push will not execute
fi
done
done
# nothing wrong, let push execute
exit 0