diff options
author | Chris Packham <judge.packham@gmail.com> | 2021-05-12 07:05:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-12 07:05:16 (GMT) |
commit | f9716e8b9042eb14de85320987300aab99300df5 (patch) | |
tree | 8e47b59adfbf4972a1be46c27317f33ccc730af6 | |
parent | fbccd749ec603ef8a82c86b8b36dacbe6757d224 (diff) | |
parent | 1dc25bf61143f4c70b09ac651cc6848737b9a631 (diff) |
Merge pull request #1504 from cmuellner/git-annotated-tags
scripts/functions: Add better support for annotanted git tags
-rw-r--r-- | scripts/functions | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/functions b/scripts/functions index 4ea3c5a..60bcbe9 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1951,8 +1951,14 @@ CT_GetVersion_git() local branch="${devel_branch:-master}" if [ -z "${devel_revision}" ]; then - local matches=`git ls-remote --exit-code "${devel_url}" --refs "${branch}" \ + # First try to dereference an annotated tag. + local matches=`git ls-remote --exit-code "${devel_url}" --refs "${branch}^{}" \ || echo "not found"` + # If we don't have an annotated tag, let's take the reference as is. + if [ "${matches}" = "not found" ]; then + matches=`git ls-remote --exit-code "${devel_url}" --refs "${branch}" \ + || echo "not found"` + fi local best using ref # Cannot test $?, setting a trap on ERR prevents bash from returning the |