Nasdaq / semver-git

Gradle plugin that combines git tags and semantic versioning, and sets the gradle version property accordingly.
MIT License
45 stars 15 forks source link

`index is out of range 0..-1` error when git tags do not have count and hash #27

Open rigdent opened 2 years ago

rigdent commented 2 years ago

Hello,

I'm getting the following error on version 3.0.0

Caused by: java.lang.IndexOutOfBoundsException: index is out of range 0..-1 (index = 0)
        at com.cinnober.gradle.semver_git.SemverGitPlugin.getGitVersion(SemverGitPlugin.groovy:48)

on my repo because my git tag looks like

➜  ✗ git describe --tags --dirty --abbrev=7
v1.1.0

So there's no count or hash, so the regex match doesn't yield any results for count and hash. What's the best course of action? This was on a RHEL 7 box.

Also, parseVersion also fails for v-prefixed versions like above. Is that intentional? Are tags without the v prefix recommended?

Thanks

deepy commented 2 years ago

The latest version of master contains support for v-prefix versions but as I've changed jobs I don't have the ability to push a new release to the plugin portal

If you got some way of reproducing the index is out of range issue then I think it's a fairly easy fix

TalissonBento commented 1 year ago

happened with me also, has someone solved that?