Closed beruic closed 7 years ago
That's a nice use case, I agree that it would be good to support this. I would propose to change the option from boolean to string (with a falsey value meaning "no dirty mark at all") in the next major version that I'm planning.
It's correct that the dirty state is not directly related to semver, but whether or not the repository is dirty is already indicated by the boolean dirty
of the output object regardless of settings. The dirtySemver
setting only affects whether or not the dirty mark should be included in the part of semverString
that is reserved for build information and the like, as described in the semver specification. The semverString
property and its associated options are only meaningful when the latest tag can be parsed as a semver. (If the tag is not a valid semver, you can still read the other properties from the output object and use them to produce a custom formatted string.)
When you say "the version string", do you mean semverString
or one or more other fields? semverString
is currently the only output field that is actually a formatted string, raw
is just the raw output from git describe --long --dirty --always
and the other fields are parsed components of raw
.
With "the version string" I mean the raw output from get describe
. No dirty string or anything.
Took a while, but I finally released v4.0.0. Now there is an option dirtyMark
that can be used to customize the mark, without messing up anything else. This option is independent from dirtySemver
, which you can just ignore if you are not interested in semver.
Currently
-dirty
is appended to the version string when the repository is dirty. It would be cool with an option to define what should be appended (e.g. I want to append the current username).Side note: Also. I don't understand why the dirty option is prepended with
semver
as it doesn't really have anything to do with semver that it is dirty.