Subject: | [Git::NextVersion] should look only at tags on the current branch |
When determining the next version to use, [Git::NextVersion] should only
n++ from *the last tag on the current branch*, not the most recent tag
in the entire repository. This allows one to follow a branching model
like http://nvie.com/posts/a-successful-git-branching-model/ (or any,
really; this is just a nice illustration) where one switches to a
different branch to do particular releases.
This is the scenario I just ran into:
- my 'stable' branch has v1.000000 as its most recent release
- 'master' has v1.000000 in its history, but has since also seen a
v1.001000 and v1.002000 as "dev" releases
- I needed to do a hotfix against v1.000000, so I switched to 'stable',
cherry-picked my changes, and went to do a release, wanting a release
version of v1.000001. Instead I got v1.002001, and had to manually override.
- If the most recent tag on the current branch was used, I would have
gotten v1.000001 as desired.
rjbs suggests that this behaviour might be controllable with a config
var; I agree, but IMHO the behaviour I described should be the default.
Also, one would need to check that the selected version hasn't been
duplicated by a release already - so all tags in the repository still
need to be scanned, to check for such dupes. (probably in that case it
would be fair to bail out and request the user manually override the
version with V=, as it would be difficult to calculate the next version
automatically.)