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
595 stars 87 forks source link

Unable to fetch from repositories that have tags of format 0.1.2.deadbeef #16

Closed stream-aha closed 7 years ago

stream-aha commented 7 years ago

Unable to fetch from repositories that have tags of format 0.1.2.deadbeef It is because latestTag variable is, in this case, empty. I've made a workaround there, but I am not sure whether it should get merged or not.

brikis98 commented 7 years ago

Yea, as mentioned in the docs, fetch only supports a certain type of version number currently:

fetch assumes that a repo's tags are in the format vX.Y.Z or X.Y.Z to support Semantic Versioning parsing. Repos that use git tags not in this format cannot currently be used with fetch.

What might make sense for a PR to improve this is to look in the tag for a regex of the form (number.number.number) and ignore any junk around that (e.g. .*(\d+\.\d+\.\d+)\..*). That would handle the original cases fetch supports, plus yours.

stream-aha commented 7 years ago

Why is that tags are required to be in any format? When someone wants to fetch a specific tag "a.z-G" I think it should be possible by using switch: --tag="=a.z-G". In this case the latest tag is not needed. Is there anything I don't see why this is not possible?

brikis98 commented 7 years ago

The reason we parse the tag is so we can read out the MAJOR.MINOR.PATCH aspects to enforce tag constraints. I suppose if you don't specify a --tag parameter, or the parameter you specify does not include one of the special tag constraint characters (=, !=, <, >, etc) then we could ignore the format entirely...

stream-aha commented 7 years ago

@brikis98 Yes, it would be nice and it was the original idea I was thinking about. When user selects one of the first two tag constraint pattern(1.0.7, =1.0.7) format is not important since the desired tag is exactly the same as specified(not newer or older).

josh-padnick commented 7 years ago

@brikis98 I'd be good with an =1.0.7 or 1.0.7 format being directly supported for arbitrary tag names. The only benefit of adhering to SemVer is so we can meaningfully interpret the user's desired acceptable versions, but "only this one version" seems like a reasonable use case.

brikis98 commented 7 years ago

Fair enough! @stream-aha, are you interested in submitting a PR?

stream-aha commented 7 years ago

Yes, I will submit a PR.

stream-aha commented 7 years ago

I think this is solved by PR #18 . I'm closing this