gradle-semantic-release-plugin icon indicating copy to clipboard operation
gradle-semantic-release-plugin copied to clipboard

Error when git repository has no commits

Open grv87 opened this issue 7 years ago • 4 comments

Suppose that you just created directory, run git init and wrote simple build script that uses semantic-release plugin. Running it could give you an exception:

* What went wrong:
No commit found for revision string: HEAD

Demo build script (don't forget to do git init) and stacktrace: https://gist.github.com/grv87/1b445bf9daf81bd3f6764ff8c0ef2dde

The problem arises only when some other part of build script tries to use version property. Plugin then throws an error.

Semver FAQ recommends to start development with 0.1.0 version, so it could be used as start.

grv87 avatar Oct 21 '17 22:10 grv87

I think this is related to #24. Internally my plugin uses the gradle-git plugin. I will have a look at this.

Semver FAQ recommends to start with 0.1.0, but it also says, that there are no guarantees about backwards compatibility until version 1.0.0 is reached. Therefore in semantic-release the first version to be released is 1.0.0. Even if that means that version 2.0.0 and 3.0.0 will come soon.

With that said, the first version must always be 1.0.0(-SNAPSHOT)

tschulte avatar Oct 23 '17 13:10 tschulte

I agree with you about 1.0.0 for now. But there is an open discussion about dropping this rule: https://github.com/mojombo/semver/issues/221

grv87 avatar Oct 23 '17 17:10 grv87

Thank you very much for that link. I didn't know that. I will give a talk at http://javaland.eu about semantic-release (using this plugin, of course). I will incorporate that info.

tschulte avatar Oct 24 '17 07:10 tschulte

Also I suspect there is a problem when remote refers to local directory. Although, I haven't tested it yet.

grv87 avatar Oct 24 '17 20:10 grv87