Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only consider version tags #100

Closed
WalkerCodeRanger opened this issue Oct 9, 2019 · 4 comments · Fixed by #129
Closed

Only consider version tags #100

WalkerCodeRanger opened this issue Oct 9, 2019 · 4 comments · Fixed by #129

Comments

@WalkerCodeRanger
Copy link

I had a tag git-info-setup that happened to be the most recent tag in my history. Since GitInfo looks for the most recent tag, this broken the base version calculation.

Since only specific patterns are allowed for base version, the git "describe" command should be filtered to those tag patterns. Otherwise, using tags for other things breaks the version. It should be valid to use tags for more than just versions.

@kzu
Copy link
Member

kzu commented Oct 15, 2019

Good point! If you don't use tags for versions, you can skip their processing with $(GitIgnoreTagVersion), but I guess your scenario is that you do use tags for versions...

@MattiasEppler
Copy link

Hi kzu
I thing you don't have understand the problem. WalkerCodeRanger do not want to disable the versioning with tags. He want's to have tags with other things additional to version tags.

Whe have the same problem. If you create a bugfix branch with gitFlow an close the branch a tag is created with the name of the bugfix branch. Like my_super_bugfix.

The generated version is 0.0.0.commits.hash and not using the numbers of the latest version tag.

So gitInfo should only use the tags with versions and other tags should be ignored.

@DNF-SaS
Copy link

DNF-SaS commented Nov 15, 2019

We have the same problem using gitlab (which generates own refs / tags) killing the versioning. :-(
Please make GitInfo search for a tag named a certain convention (e.g. vX.X.X) and ignore all other tags.

@kzu
Copy link
Member

kzu commented Sep 20, 2020

Hey folks,
not disagreeing with the need here. I just haven't found a need for this myself, so this is quite low on my priority list. If you have the git-foo required for that, please take a look at the target that looks it up and feel free to provide a PR. I'll gladly accept it. It's not precisely trivial doing "foreach" style processing in MSBuild, but I guess if you pull first all the tag names into an itemgroup (using ItemName instead of PropertyName for the output of the Exec, and then get another item filtering those by a the condition that they pass the version regex, that might work.

Thanks!

kzu added a commit that referenced this issue Sep 24, 2020
Fixes #100, brings #72 in.

It didn't make a lot of sense to require the entire branch or tag to be semver2, from beginning to end. It's usually the case that branches are named like `rel/vX.Y.Z`, for example, and we were forcing such common naming conventions to customize GitInfo unnecessarily.

So to make it more flexible and powerful, we add two things with this commit:

1. We no longer enfore version to match from beginning of string (`^` removed from default regex). We still require the version to be the last part. However, if that still doesn't match the desired behavior, users can now override the default expression by just setting `GitBaseVersionRegex` which is now "public" and documented.

2. We also allow the filter for tags to be specified, so that "weird" tags aren't considered for matching, and can easily be filtered out by providing, for example, a `rel/v*` expression for `GitTagRegex)`.
kzu added a commit that referenced this issue Sep 24, 2020
Fixes #100, brings #72 in.

It didn't make a lot of sense to require the entire branch or tag to be semver2, from beginning to end. It's usually the case that branches are named like `rel/vX.Y.Z`, for example, and we were forcing such common naming conventions to customize GitInfo unnecessarily.

So to make it more flexible and powerful, we add two things with this commit:

1. We no longer enfore version to match from beginning of string (`^` removed from default regex). We still require the version to be the last part. However, if that still doesn't match the desired behavior, users can now override the default expression by just setting `GitBaseVersionRegex` which is now "public" and documented.

2. We also allow the filter for tags to be specified, so that "weird" tags aren't considered for matching, and can easily be filtered out by providing, for example, a `rel/v*` expression for `GitTagRegex)`.
kzu added a commit that referenced this issue Sep 24, 2020
Fixes #100, brings #72 in.

It didn't make a lot of sense to require the entire branch or tag to be semver2, from beginning to end. It's usually the case that branches are named like `rel/vX.Y.Z`, for example, and we were forcing such common naming conventions to customize GitInfo unnecessarily.

So to make it more flexible and powerful, we add two things with this commit:

1. We no longer enfore version to match from beginning of string (`^` removed from default regex). We still require the version to be the last part. However, if that still doesn't match the desired behavior, users can now override the default expression by just setting `GitBaseVersionRegex` which is now "public" and documented.

2. We also allow the filter for tags to be specified, so that "weird" tags aren't considered for matching, and can easily be filtered out by providing, for example, a `rel/v*` expression for `GitTagRegex)`.

Bump to 2.1 since it might be breaking for some consumers.
@kzu kzu closed this as completed in #129 Sep 24, 2020
@devlooped devlooped locked and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants