2021-09-29 14:00:00 +00:00
|
|
|
#! /bin/sh
|
2020-04-13 20:57:30 +00:00
|
|
|
|
|
|
|
# lists all available tags from a git repository
|
|
|
|
|
|
|
|
scriptName=list-git-tags # do not use the .wrapped name
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Usage: $scriptName <repository url> [<package name> [<debug file path>]]"
|
|
|
|
}
|
|
|
|
|
|
|
|
repo="$1" # git repository url
|
|
|
|
pname="$2" # package name
|
|
|
|
file="$3" # file for writing debugging information
|
|
|
|
|
|
|
|
if [ -z "$repo" ]; then
|
|
|
|
echo "$scriptName: Missing git repository url"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# print a debugging message
|
|
|
|
if [ -n "$file" ]; then
|
|
|
|
echo "# Listing tags for $pname at $repo" >> $file
|
|
|
|
fi
|
|
|
|
|
|
|
|
# list all tags from the remote repository
|
|
|
|
tags=$(git ls-remote --tags --refs "$repo")
|
|
|
|
|
|
|
|
# keep only the version part of the tag
|
|
|
|
tags=$(echo "$tags" | cut --delimiter=/ --field=3)
|
|
|
|
|
|
|
|
echo "$tags"
|