2021-03-31 16:38:58 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
progname="$(basename $0)"
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
cat >&2 <<EOF
|
|
|
|
Usage: $progname <git repo URL>
|
|
|
|
|
|
|
|
Finds all garlic/* branches and their current commit of the given
|
|
|
|
repository and builds the gitTable to be used in nix derivations.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
garlic-git-table ssh://git@bscpm03.bsc.es/garlic/apps/heat.git
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-04-01 17:48:10 +02:00
|
|
|
echo '{'
|
|
|
|
echo " # Auto-generated with $progname on $(date --rfc-3339=date) for repo:"
|
|
|
|
echo " # $1"
|
|
|
|
echo
|
2021-03-31 16:38:58 +02:00
|
|
|
git ls-remote $1 'garlic/*' |\
|
|
|
|
sed 's@refs/heads/@@' |\
|
|
|
|
awk '{printf "\"%s\" = \"%s\";\n", $2, $1}' |\
|
|
|
|
column -t -o ' ' |\
|
|
|
|
sed 's/^/ /'
|
2021-04-01 17:48:10 +02:00
|
|
|
echo '}'
|