summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-06-28 14:46:00 +0200
committerOliver Smith <osmith@sysmocom.de>2019-07-01 13:41:40 +0200
commita5d5bedd55f0d1f9411a9c3e24d59fb9f607e93a (patch)
tree8e567403e8641663e53237f982039264b49dbfef
parente26866af0da040a7ed37b17280a7f16a96999e09 (diff)
common.sh: osmo_git_last_commits_tags: add "all"
Allow printing all tags instead of only the N most recent ones. Related: OS#3870 Change-Id: I684c6881915831b33b679e8ae873213beb034ab7
-rw-r--r--scripts/common.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/common.sh b/scripts/common.sh
index 0a32c31..30ab53f 100644
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -16,7 +16,7 @@ osmo_git_head_commit() {
# Print last tags and related commits for an Osmocom git repository, e.g.:
# "ec798b89700dcca5c5b28edf1a1cd16ea311f30a refs/tags/1.0.1"
# $1: Osmocom repository
-# $2: amount of commit, tag pairs to print (default: 1)
+# $2: amount of commit, tag pairs to print (default: 1, set to "all" to print all)
# $3: string to print when there are no tags (default: empty string)
osmo_git_last_commits_tags() {
# git output:
@@ -31,7 +31,9 @@ osmo_git_last_commits_tags() {
ret="$(git ls-remote --tags "$OSMO_GIT_URL/$1")"
ret="$(echo "$ret" | grep 'refs/tags/[0-9.]*$' || true)"
ret="$(echo "$ret" | sort -V -t/ -k3)"
- ret="$(echo "$ret" | tail -n "$2")"
+ if [ "$2" != "all" ]; then
+ ret="$(echo "$ret" | tail -n "$2")"
+ fi
if [ -n "$ret" ]; then
echo "$ret"