#!/bin/sh
# Float submodules (plugins/aphrodite, vendor/headroom, vendor/rtk) to their
# tracking branch tip (`branch = Current` in .gitmodules) after every
# checkout, auto-committing the resulting pin bump - see
# .githooks/lib/sync-submodules.sh for the full design and the safety
# guards (dirty + not-yet-pushed-commit checks) that replace the old
# "always reset to whatever's pinned" behavior this hook used to have.
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)"
[ -n "$REPO_ROOT" ] && [ -f "$REPO_ROOT/.githooks/lib/sync-submodules.sh" ] || exit 0
# shellcheck source=lib/sync-submodules.sh
. "$REPO_ROOT/.githooks/lib/sync-submodules.sh"
sync_submodules
