markchalloner / git-semver

Git plugin for Semantic Versioning
MIT License
381 stars 43 forks source link

Version prefix not applying to current version in plugins #31

Closed srt4rulez closed 5 years ago

srt4rulez commented 5 years ago

Using the example plugin without modification, the "current version" argument doesn't contain VERSION_PREFIX config setting.

See output:

$ git semver minor

User plugin "example.sh":

  New version: v0.2.0
  Current version: 0.1.0
  ...
v0.2.0

Notice how "current version" is "0.1.0" while new version is "v0.2.0" (with v)

This seems to be because the version-do method is being called without the VERSON_PREFIX for $version in version-major, version-minor, and version-patch :

https://github.com/markchalloner/git-semver/blob/d838cb34780a29d104ed20ef18465c44918b0f64/git-semver.sh#L165

I can make a PR.

markchalloner commented 5 years ago

Thanks for the report. Looking at the code it seems like version-get's return would be the natural place to prefix this.

I can make a PR.

Yes please.

srt4rulez commented 5 years ago

Right, that was my first thought as well, but then the checks for a blank version in patch, minor, and major will possibly never be true (if a version prefix is set)

https://github.com/markchalloner/git-semver/blob/d838cb34780a29d104ed20ef18465c44918b0f64/git-semver.sh#L156-L161

Unless we strip off the version prefix for that check?

markchalloner commented 5 years ago

@srt4rulez the checks would still be valid, version-get returns without echoing if it can't parse out a valid version.

srt4rulez commented 5 years ago

Yes, I noticed that after doing some tests. I see you pulled in #27, which has some major changes.

srt4rulez commented 5 years ago

This seems to be fixed from #33.