gruntwork-io / fetch

Download files, folders, and release assets from a specific git commit, branch, or tag of public and private GitHub repos.
https://www.gruntwork.io/
MIT License
587 stars 90 forks source link

Handle tags that do not follow semantic versioning #75

Closed pete0emerson closed 3 years ago

pete0emerson commented 3 years ago

Your documentation indeed points out that tags need to follow SemVer:

Note that fetch assumes git tags are specified according to Semantic Versioning principles.

However, git tags that are not semantically versioned are valid tags, and if one exists in the source repository, the tool breaks, even if you are not requesting a --tag.

I suggest that tags should not be required to be semantically versioned unless a Tag Contraint Expression is specified.

This would allow the tool to work in repositories where non-SemVar tags exist.

To replicate:

fetch $ git rev-parse HEAD
83ed55048791ec5385d4143a78798e2a6c82b9f8
fetch $ ./fetch --repo=https://github.com/pete0emerson/demo --branch=main demo
Downloading latest commit from branch "main" of https://github.com/pete0emerson/demo ...
Extracting files from <repo>/ to demo ...
Download and file extraction complete.
demo $ git tag banana
demo $ git push --tags
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/pete0emerson/demo.git
 * [new tag]         banana -> banana
fetch $ ./fetch --repo=https://github.com/pete0emerson/demo --branch=main demo
ERROR: Error occurred while computing latest tag that satisfies version contraint expression: -1 - Malformed version: banana