#!/bin/bash
# Installed by coredesktop-dev; remove with: coredesktop-dev hooks remove
#
# Runs coredesktop-dev check before git push, and stops the push if it fails.

CHECK="$HOME/.local/bin/coredesktop-dev"

if [ ! -x "$CHECK" ]; then
  echo "pre-push: coredesktop-dev isn't installed, so the checks didn't run."
  exit 0
fi

if ! "$CHECK" check; then
  echo
  echo "pre-push: the checks failed, so nothing was pushed."
  echo "To push anyway: git push --no-verify"
  exit 1
fi
