#!/bin/bash

set -e

gitpath=$(git rev-parse --git-dir)
basepath=$(git rev-parse --show-toplevel)
cp "${gitpath}/COMMIT_EDITMSG" "${basepath}/COMMIT_EDITMSG"
gpg --sign  "${basepath}/COMMIT_EDITMSG"
git commit -S

rm "${basepath}/COMMIT_EDITMSG" "${basepath}/COMMIT_EDITMSG.gpg"