osmith submitted this change.

View Change


Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve
scripts/common: osmo_git_last_commit…: add vars

Add variable names for $1, $2, $3 so the logic is easier to follow.

Related: OS#6227
Change-Id: I7abbcefc8d5bd4c5b84c30a7e38ca3dcb855dd56
---
M scripts/common.sh
1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/scripts/common.sh b/scripts/common.sh
index 72be4fc..8099499 100644
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -74,19 +74,23 @@
# ee618ecbedec82dfd240334bc87d0d1c806477b0 refs/tags/debian/0.9.13-0_jrsantos.1
# a3fdd24af099b449c9856422eb099fb45a5595df refs/tags/debian/0.9.13-0_jrsantos.1^{}
# ...
+ local project="$1"
+ local amount="$2"
+ local default_str="$3"
local url ret
- url="$(osmo_git_clone_url "$1")"
+
+ url="$(osmo_git_clone_url "$project")"
ret="$(git ls-remote --tags "$url")"
ret="$(echo "$ret" | grep 'refs/tags/[0-9.]*$' || true)"
ret="$(echo "$ret" | sort -V -t/ -k3)"
- if [ "$2" != "all" ]; then
- ret="$(echo "$ret" | tail -n "$2")"
+ if [ "$amount" != "all" ]; then
+ ret="$(echo "$ret" | tail -n "$amount")"
fi

if [ -n "$ret" ]; then
echo "$ret"
else
- echo "$3"
+ echo "$default_str"
fi
}


To view, visit change 34816. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I7abbcefc8d5bd4c5b84c30a7e38ca3dcb855dd56
Gerrit-Change-Number: 34816
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged