Skip to content

How to override version strategy computation #1419

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

Closed
Bhaal22 opened this issue Jun 4, 2018 · 5 comments
Closed

How to override version strategy computation #1419

Bhaal22 opened this issue Jun 4, 2018 · 5 comments
Labels

Comments

@Bhaal22
Copy link

Bhaal22 commented Jun 4, 2018

Hi,

First, I want to say we are definitely in a bad state regarding semver.
We have a library which was is submodule of our global product. We never wanted to ship the library as a single component to external teams. So we tagged / branched the library repository with the version of the global product.

That's why we have such a log while running gitversion

INFO [06/04/18 12:13:34:70] Begin: Calculating base versions
  INFO [06/04/18 12:13:34:73] Fallback base version: 0.1.0 with commit count source bf49308fd315ba63da4c0ee557d8d888332fbfe6 (Incremented: None)
  INFO [06/04/18 12:13:34:81] Git tag 'v4.0.1': 4.0.1 with commit count source 8647a67c17b054caa58b8aa2281246a208ecfa28 (Incremented: 4.0.2)
  INFO [06/04/18 12:13:34:84] Git tag 'v3.2': 3.2.0 with commit count source 81f5503ab4fc25ae3ffd174cc063b0ec2295a733 (Incremented: 3.2.1)
  INFO [06/04/18 12:13:34:87] Git tag 'v3.1': 3.1.0 with commit count source 289a40aea81b3ab07a01f5631fd2a257c0108208 (Incremented: 3.0.1)
  INFO [06/04/18 12:13:34:91] Git tag 'v3.0': 3.0.0 with commit count source 289a40aea81b3ab07a01f5631fd2a257c0108208 (Incremented: 3.0.1)
  INFO [06/04/18 12:13:34:94] Git tag 'v2.0': 2.0.0 with commit count source e32304b92f52af200d097cccfe0b8197986e12f5 (Incremented: 2.0.1)
  INFO [06/04/18 12:13:34:96] Git tag '11.0.0': 11.0.0 with commit count source e32304b92f52af200d097cccfe0b8197986e12f5 (Incremented: 11.0.1)
  INFO [06/04/18 12:13:34:98] Merge message 'Merge remote-tracking branch 'origin/v11.2' into develop': 11.2.0 with commit count source 5dc711c6637d54cae35bd6eef6f17e26441f6376 (Incremented: None)
  INFO [06/04/18 12:13:34:99] Found multiple base versions which will produce the same SemVer (11.2.0), taking oldest source for commit counting (Merge message 'Merge remote-tracking branch 'origin/v11.2' into develop')
  INFO [06/04/18 12:13:34:99] Base version used: Merge message 'Merge remote-tracking branch 'origin/v11.2' into develop': 11.2.0 with commit count source 5dc711c6637d54cae35bd6eef6f17e26441f6376 (Incremented: None) 

You can see at the end thatt we have merge commits.
Since I would not like to tag all my commits, I would like to know if there is a way to run only the TaggedCommitVersionStrategy and not use old commits to make version computations.

Our global product is now in 12.x I would not like to make my library pass to v12.x just to be upper than the computed version.

Is there a way maybe to use the more recent commit in this history to be considered as the last version to use as a base to compute next versions?

Thank you.

@Bhaal22
Copy link
Author

Bhaal22 commented Jun 4, 2018

Found a way by ignoring the commits related to that.
Maybe would be a good idea to be able to disable commit stategies by configuration.

@ghost
Copy link

ghost commented Jun 4, 2018

@Bhaal22 what was the configuration to ignore a specific commit?

I do think it would be good to have a way to turn this function off, given there is a TODO in the code to make it configurable.

@Bhaal22
Copy link
Author

Bhaal22 commented Jun 4, 2018

here is wha I did:

Generate an empty configuration file:

gitversion init

and in the generated GitVersion.yml

branches: {}
ignore:
  sha:
    - 921478254e0c1c0c03d4b727089a1ad7b0a6fc9d
    - ec50b5fa59cbc97ae4ce7582ffd808cfdab560a0
    - 1bf3d3db32fb7217a7292b9bc53196e2eed83736
    - 5dc711c6637d54cae35bd6eef6f17e26441f6376

Those SHAs are my merged commits.

@ghost
Copy link

ghost commented Jun 4, 2018

@Bhaal22 Ahh very nice. Thank you!

@stale
Copy link

stale bot commented Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 29, 2019
@stale stale bot closed this as completed Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant