1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-08-18 12:50:16 +02:00
Files
flashrom/util/git-hooks/pre-push
Nico Huber 0bfa8198ae Prepare for a single branch on gerrit
Discourage all direct pushes to the upstream repositories, no matter the
branch. Also, skip adding Change-Ids to fixup! and squash! commits.

Change-Id: I13aa478edd200ce85da86962e4f94f7ac446b05f
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/22330
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2017-12-09 23:12:33 +00:00

30 lines
885 B
Bash
Executable File

#!/bin/sh
# A hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# 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>
remote="$1"
url="$2"
upstream_pattern="github\.com.flashrom/flashrom(\.git)?|flashrom\.org.git/flashrom(\.git)?"
# We use gerrit only and don't want direct pushes
if echo "$url" | grep -q -E "$upstream_pattern" ; then
exit 1
fi
exit 0