#!/bin/sh

exec 1>&2

COMMIT_MESSAGE=`head -n 1 $1`

if [ -z "$COMMIT_MESSAGE" ]; then
    exec < /dev/tty && docker run --rm -it \
        -v $(pwd)/.git:/opt/webedia/src/.git \
        -e USER_ID=$(id -u) \
        -e GROUP_ID=$(id -g) \
        europe-docker.pkg.dev/prj-shd-prd-registry-8ed4/foundation/commitizen:19.3
else
    echo "A commit message has been detected, skip prepare-commit-msg hook"
fi
