#!/bin/sh

ref="$1"
oldrev="$2"
newrev="$3"

# --- Safety check

if [ -z "$GIT_DIR" ]; then
        echo "Don't run this script from the command line." >&2
        echo " (if you want, you could supply GIT_DIR then run" >&2
        echo "  $0 <ref> <oldrev> <newrev>)" >&2
        exit 1
fi

if [ -z "$ref" ] || [ -z "$oldrev" ] || [ -z "$newrev" ]; then
        echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
        exit 1
fi

# --- Disallow all pushes

echo "*** Pushing to the superproject is not allowed" >&2
echo "***" >&2
echo "*** If you would like to update the superproject, use remctl" >&2
exit 1