semver-git icon indicating copy to clipboard operation
semver-git copied to clipboard

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

Open rigdent opened this issue 3 years ago • 2 comments

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

rigdent avatar Sep 09 '22 14:09 rigdent

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

deepy avatar Sep 09 '22 14:09 deepy

happened with me also, has someone solved that?

TalissonBento avatar May 10 '23 19:05 TalissonBento