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

Option to exclude merges when calculating SemVerPatch #124

Closed
christianerbsmehl opened this issue Sep 21, 2020 · 1 comment · Fixed by #125
Closed

Option to exclude merges when calculating SemVerPatch #124

christianerbsmehl opened this issue Sep 21, 2020 · 1 comment · Fixed by #125

Comments

@christianerbsmehl
Copy link
Contributor

Hi, I recently implemented GitInfo in one of my team's projects but I'm struggling with setting the correct version numbers in CI. We are using a custom Gitlab flow, which means we are having a develop branch in which all feature branches are merged. When preparing a release, we are eventually bumping the major/minor version in the project's GitInfo.txt and then merging the develop branch into the master branch. This causes a problem, because the merge creates one additional commit and the GitSemVerPatch is incemented by one. With this, it is never possible to release a x.x.0 Version from the master branch because with the merge commit, the last digit is always (at least) 1. This is weird and hard to understand for consumers why there is no .0-Version.

I dug a bit into the GitInfo.targets file and saw it is using the git rev-list --count command to retrieve the number of commits since the last change of the GitInfo.txt file. This command has an additional flag --no-merges which could be used to solve this problem. Is it possible to make the desired behavior available via config (e.g. $(GitCommitsIgnoreMerges)) or am I missing something?

@kzu
Copy link
Member

kzu commented Sep 21, 2020

Yes, that would be a good addition! I'd gladly take a PR if that change gives you the desired behavior. To make it backwards compatible, I'd make GitCommitsIgnoreMerges default to false though.

You can try this locally by just modifying your restored GitInfo.targets and once you're satisfied with the behavior, you can send the PR.

Thanks!

@kzu kzu closed this as completed in #125 Sep 23, 2020
@devlooped devlooped locked and limited conversation to collaborators Sep 11, 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.

2 participants