From 0afba093303a51fad7715846c2051d35cc126ba6 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Thu, 12 Jul 2018 17:00:02 +0100 Subject: [PATCH] Use --version-sort instead of -n for role version bump Using sort -n can mean that version x.9 is taken above version x.13 due to how the sort will happen. It is a better approach to adopt sort --version-sort Change-Id: Ied5a2206f5d86838f2b0e083b11f9a063c5a1f63 --- scripts/sources-branch-updater-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sources-branch-updater-lib.sh b/scripts/sources-branch-updater-lib.sh index 0b86372e26..2c06b8da2b 100644 --- a/scripts/sources-branch-updater-lib.sh +++ b/scripts/sources-branch-updater-lib.sh @@ -248,7 +248,7 @@ update_ansible_role_requirements() { # If the role_src is NOT from git.openstack.org, try to get a tag first unless we are working on master if [[ ${role_src} != *"git.openstack.org"* ]] && [[ "${force_master}" != "true" ]]; then - role_version=$(git ls-remote --tags ${role_src} | awk '{print $2}' | grep -v '{}' | cut -d/ -f 3 | sort -n | tail -n 1) + role_version=$(git ls-remote --tags ${role_src} | awk '{print $2}' | grep -v '{}' | cut -d/ -f 3 | sort --version-sort | tail -n 1) fi # Grab the latest SHA that matches the specified branch