pre-push-hook.sh raw

   1  #!/usr/bin/env bash
   2  # Copyright (c) 2014-2021 The Limenka developers
   3  # Distributed under the MIT software license, see the accompanying
   4  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
   5  
   6  export LC_ALL=C
   7  if ! [[ "$2" =~ ^(git@)?(www.)?github.com(:|/)limenka/limenka(.git)?$ ]]; then
   8      exit 0
   9  fi
  10  
  11  while read LINE; do
  12      set -- A "$LINE"
  13      if [ "$4" != "refs/heads/master" ]; then
  14          continue
  15      fi
  16      if ! ./contrib/verify-commits/verify-commits.py "$3" > /dev/null 2>&1; then
  17          echo "ERROR: A commit is not signed, can't push"
  18          ./contrib/verify-commits/verify-commits.py
  19          exit 1
  20      fi
  21  done < /dev/stdin
  22