#!/bin/sh
# Check Autodeploy repos status.
# If there are changes or uncommitted, autodeploy will not trigger.

THIS_FILE="$(readlink -f "$0" || realpath "$0")"
THIS_DIR="$(dirname "${THIS_FILE}")"
COMPOSE_DIR="${COMPOSE_DIR:-$(dirname "${THIS_DIR}")}"

if [ -f "${COMPOSE_DIR}/read-configs.include.sh" ]; then
    . "${COMPOSE_DIR}/read-configs.include.sh"

    # Get BIRDHOUSE_AUTODEPLOY_EXTRA_REPOS
    read_configs
fi

for r in "${COMPOSE_DIR}" ${BIRDHOUSE_AUTODEPLOY_EXTRA_REPOS}; do
    echo "=== $r"
    cd "$r"
    git status -v
    cd -
done
