diff options
Diffstat (limited to 'nixpkgs/pkgs/common-updater/scripts/list-git-tags')
-rwxr-xr-x | nixpkgs/pkgs/common-updater/scripts/list-git-tags | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/common-updater/scripts/list-git-tags b/nixpkgs/pkgs/common-updater/scripts/list-git-tags new file mode 100755 index 000000000000..ff09671c7cb0 --- /dev/null +++ b/nixpkgs/pkgs/common-updater/scripts/list-git-tags @@ -0,0 +1,32 @@ +#! /bin/sh -x + +# 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" |