palantir / gradle-git-version

a Gradle plugin that uses `git describe` to produce a version string.
Apache License 2.0
382 stars 76 forks source link

`gitVersion()` is failing due to the `--match` pattern not including quotes #839

Open kihaki opened 2 months ago

kihaki commented 2 months ago

What happened?

Looks like gitVersion() is failing due to the --match pattern not including quotes

What did you want to happen?

Calling gitVersion() should print the correct version when providing no pattern

Looking through the source code I have found that gitVersion() basically is a call to git describe --tags --always --first-parent --abbrev=7 --match=* HEAD which fails with the following error when run directly: no matches found: --match=* and resulting in an unknown version.

It seems that the correct command would be git describe --tags --always --first-parent --abbrev=7 --match='*' HEAD (notice the '' for the match), which gives the correct tag to work with.

It seems kind of weird to me that this would not have been noticed already, so maybe I am using the API wrongly?

My git version is 2.43.0