diff options
author | Christoph Muellner <cmuellner@linux.com> | 2021-05-06 02:21:33 +0200 |
---|---|---|
committer | Christoph Muellner <cmuellner@linux.com> | 2021-05-06 02:21:33 +0200 |
commit | 1dc25bf61143f4c70b09ac651cc6848737b9a631 (patch) | |
tree | ab01baaff5cfb519f2c9fae4e41c2d2da7224e8a /scripts | |
parent | 0528a9d744cc95aac3df40d5a1666f0a1051cf5d (diff) | |
download | crosstool-ng-1dc25bf61143f4c70b09ac651cc6848737b9a631.tar.gz crosstool-ng-1dc25bf61143f4c70b09ac651cc6848737b9a631.tar.bz2 crosstool-ng-1dc25bf61143f4c70b09ac651cc6848737b9a631.zip |
scripts/functions: Add better support for annotanted git tags
Annotated git tags are git objects with their own ID.
They contain the commit ID where they point to.
When downloading from annotated tags, we currently get the following warning:
"Revision being fetched changed to ${new_unique_id};"
The old unique_id is the ID of the annotated tag and the new unique_id
is the commit it points to.
Let's resolve this by first assuming to have an annotated tag and let
git ls-remote dereference it. If that fails (e.g. if it can't be
dereferenced because it is not an annotated tag), then let's proceed as
before and don't do any dereferencing.
Signed-off-by: Christoph Muellner <cmuellner@linux.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/functions | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/functions b/scripts/functions index 4ea3c5a8..60bcbe96 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 |