#!/bin/bash
set -e
cd "$(dirname "$0")/.."
. scripts/functions.sh

# can't summarize the submodules without having the submodules
ensure_submodules

FILE=repos/tags
echo '# autogenerated by ./scripts/collect-tags' > $FILE
echo '#' >> $FILE
echo '# used to determine submodule tags without the need for' >> $FILE
echo '# checking out the whole submodule' >> $FILE
echo "" >> $FILE

# get list of submodules and their current tag as `git describe` also provides


git submodule foreach --quiet 'echo $sm_path $(git describe --tags --always)'  >> $FILE

