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

Incorrect mainline version being calculated #1035

Closed
JakeGinnivan opened this issue Sep 5, 2016 · 8 comments · Fixed by #1540

Comments

@JakeGinnivan
Copy link
Contributor

commented Sep 5, 2016

Build 1 log

2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:49:94] Direct commit on master aa1d85d8e0546c06c3d81f5cc572bba98c1ea1c4 incremented base versions Patch, now 1.0.112
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:49:95] Direct commit on master bdaa98475e113dc1eb287224d7e14f9cab3d59d4 incremented base versions Patch, now 1.0.113
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:49:95] Merge commit b81e328e2903b588e92a82c7734ab33fdd00b91a incremented base versions Patch, now 1.0.114
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:50:02] Multiple possible mainlines pointing at the same commit, dropping origin/feature/BSP-15031_for_support_1.0
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:50:02] Multiple possible mainlines pointing at the same commit, dropping origin/master
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:50:02] Multiple possible mainlines pointing at the same commit, dropping origin/support/1.0
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:50:02] Found possible mainline branches: feature/BSP-15031_for_support_1.0, master, support/1.0
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:50:02] Mainline for current branch is support/1.0
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:50:02] Current branch (support/1.0) was branch from b81e328e2903b588e92a82c7734ab33fdd00b91a
2016-09-05T04:17:50.4589035Z   INFO [09/05/16 12:17:50:02] 0 commits found between b81e328e2903b588e92a82c7734ab33fdd00b91a and b81e328e2903b588e92a82c7734ab33fdd00b91a

Build 2 log

2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:51] Merge commit 895ee9e884509656fbacbcba3d7bb118871d2ec2 incremented base versions Patch, now 1.0.111
2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:60] Multiple possible mainlines pointing at the same commit, dropping origin/feature/BSP-15031_for_support_1.0
2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:60] Multiple possible mainlines pointing at the same commit, dropping origin/master
2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:60] Multiple possible mainlines pointing at the same commit, dropping origin/support/1.0
2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:60] Found possible mainline branches: feature/BSP-15031_for_support_1.0, support/BSP-15045-for-1.0, master, support/1.0
2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:61] Mainline for current branch is support/1.0
2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:61] Current branch (support/1.0) was branch from bdaa98475e113dc1eb287224d7e14f9cab3d59d4
2016-09-05T03:57:01.0729528Z   INFO [09/05/16 11:57:00:62] Direct commit on master aa1d85d8e0546c06c3d81f5cc572bba98c1ea1c4 incremented base versions Patch, now 1.0.112
2016-09-05T03:57:01.0739511Z   INFO [09/05/16 11:57:00:62] Direct commit on master bdaa98475e113dc1eb287224d7e14f9cab3d59d4 incremented base versions Patch, now 1.0.113
2016-09-05T03:57:01.0739511Z   INFO [09/05/16 11:57:00:63] 0 commits found between bdaa98475e113dc1eb287224d7e14f9cab3d59d4 and bdaa98475e113dc1eb287224d7e14f9cab3d59d4
2016-09-05T03:57:01.0739511Z   INFO [09/05/16 11:57:00:63] Performing Patch increment for current branch 

Looks like direct commits get incremented, merge commits do not. But both end up with 1.0.114

@JakeGinnivan JakeGinnivan added this to the 4.0.0 milestone Oct 2, 2016
@JakeGinnivan JakeGinnivan added the bug label Oct 2, 2016
@waynebrantley

This comment has been minimized.

Copy link

commented Nov 29, 2016

I created a tag 1.8.1 on master in my local repo.
Ran gitversion (setup for mode:Mainline). It produced 1.8.1 as the version.
Did a commit to master (again locally)
Ran gitversion. It produced 2012.11.43 as version.

@gep13

This comment has been minimized.

Copy link
Member

commented Nov 30, 2016

@waynebrantley what was the commit message that you used?

@waynebrantley

This comment has been minimized.

Copy link

commented Nov 30, 2016

Something like 'test commit'. Just any normal message.
It just seems the search for prior 'tags' does not work.
In fact, we have around 100 tags and it always gave me 2012.11.43 as version....so I created a new tag and it did see and use it....but then another commit it did not.

@gep13

This comment has been minimized.

Copy link
Member

commented Nov 30, 2016

@waynebrantley is this a public repo?

@waynebrantley

This comment has been minimized.

Copy link

commented Nov 30, 2016

No, sorry.

@JakeGinnivan

This comment has been minimized.

Copy link
Contributor Author

commented Dec 4, 2016

Try gitversion /diag it should give you a decent log of how it got that version

@wjrogers

This comment has been minimized.

Copy link
Contributor

commented Nov 19, 2018

I'm having what I think is the same problem. I have develop and master branches. I have merged develop into master four times since the commit tagged v4.0.0. Build on master gets version 4.4.0, as it should:

INFO [11/19/18 14:22:38:91] Running against branch: master (c65aef293c3b14d35f55c19bfae219e7ec20f2c3)
INFO [11/19/18 14:22:38:92] Begin: Calculating base versions
  INFO [11/19/18 14:22:39:02] Fallback base version: 0.1.0 with commit count source c4427734492a736e9c4b73bc08bcedce12762877 (Incremented: None)
  INFO [11/19/18 14:22:39:23] Git tag 'v4.0.0': 4.0.0 with commit count source 5fdd68c366b2c34eaf0789ca93740825216e5e5d (Incremented: 4.0.1)
  INFO [11/19/18 14:22:39:38] Found multiple base versions which will produce the same SemVer (4.0.1), taking oldest source for commit counting (Git tag 'v4.0.0')
  INFO [11/19/18 14:22:39:39] Base version used: Git tag 'v4.0.0': 4.0.0 with commit count source 5fdd68c366b2c34eaf0789ca93740825216e5e5d (Incremented: 4.0.1)
INFO [11/19/18 14:22:39:39] End: Calculating base versions (Took: 467.97ms)
INFO [11/19/18 14:22:39:39] Begin: Using mainline development mode to calculate current version
  INFO [11/19/18 14:22:39:41] Multiple possible mainlines pointing at the same commit, dropping origin/master
  INFO [11/19/18 14:22:39:41] Found possible mainline branches: master
  INFO [11/19/18 14:22:39:45] Mainline for current branch is master
  INFO [11/19/18 14:22:39:54] Merge commit 7f4f75841b60764ec7390b667d92f8d9f66d5891 incremented base versions Minor, now 4.1.0
  INFO [11/19/18 14:22:39:58] Merge commit 13e92f826a0eaa9ff2827a779b6fa281b7105602 incremented base versions Minor, now 4.2.0
  INFO [11/19/18 14:22:39:62] Merge commit d7ac81ed598e723d2a9ab7483f4b146d9ac07e1a incremented base versions Minor, now 4.3.0
  INFO [11/19/18 14:22:39:69] Merge commit c65aef293c3b14d35f55c19bfae219e7ec20f2c3 incremented base versions Minor, now 4.4.0
  INFO [11/19/18 14:22:39:71] 17 commits found between 5fdd68c366b2c34eaf0789ca93740825216e5e5d and c65aef293c3b14d35f55c19bfae219e7ec20f2c3
INFO [11/19/18 14:22:39:71] End: Using mainline development mode to calculate current version (Took: 320.98ms)

But building develop, which is a couple commits ahead of the last merge, gets version 4.0.13!

INFO [11/19/18 14:14:43:16] Running against branch: develop (6b92f175c8c1d0f1a67e10f1b6197964e6fa6661)
INFO [11/19/18 14:14:43:17] Begin: Calculating base versions
  INFO [11/19/18 14:14:43:27] Fallback base version: 0.1.0 with commit count source c4427734492a736e9c4b73bc08bcedce12762877 (Incremented: None)
  INFO [11/19/18 14:14:43:66] Git tag 'v4.0.0': 4.0.0 with commit count source 5fdd68c366b2c34eaf0789ca93740825216e5e5d (Incremented: 4.1.0)
  INFO [11/19/18 14:14:43:67] Found multiple base versions which will produce the same SemVer (4.1.0), taking oldest source for commit counting (Git tag 'v4.0.0')
  INFO [11/19/18 14:14:43:67] Base version used: Git tag 'v4.0.0': 4.0.0 with commit count source 5fdd68c366b2c34eaf0789ca93740825216e5e5d (Incremented: 4.1.0)
INFO [11/19/18 14:14:43:67] End: Calculating base versions (Took: 501.99ms)
INFO [11/19/18 14:14:43:68] Begin: Using mainline development mode to calculate current version
  INFO [11/19/18 14:14:43:73] Multiple possible mainlines pointing at the same commit, dropping origin/master
  INFO [11/19/18 14:14:43:73] Found possible mainline branches: master
  INFO [11/19/18 14:14:43:77] Mainline for current branch is master
  INFO [11/19/18 14:14:43:81] Current branch (develop) was branch from 681779212c7e8ad0d6327fd17c44f9de0a14b3c2
  INFO [11/19/18 14:14:43:83] Direct commit on master 074a3d7b6e26aea93a1c67adaeac25334d299b6d incremented base versions Patch, now 4.0.1
  INFO [11/19/18 14:14:43:84] Direct commit on master 16e7af1d0751caadd362423729179cfe305fc7dc incremented base versions Patch, now 4.0.2
  INFO [11/19/18 14:14:43:85] Direct commit on master 0b57ffbd32cc79ae48731fa248e14065c2f648bd incremented base versions Patch, now 4.0.3
  INFO [11/19/18 14:14:43:86] Direct commit on master a021001a9c86765e4ee21700720218edc97c8097 incremented base versions Patch, now 4.0.4
  INFO [11/19/18 14:14:43:88] Direct commit on master 820f020d46c98aa4eaca72a757fa4b17c76a9313 incremented base versions Patch, now 4.0.5
  INFO [11/19/18 14:14:43:89] Direct commit on master cf5c980eacf5b5d99c57b1cd4d23261dc409e975 incremented base versions Patch, now 4.0.6
  INFO [11/19/18 14:14:43:90] Direct commit on master 5bf5188cbfb7dc06c480b130f2ebda089fbc776f incremented base versions Patch, now 4.0.7
  INFO [11/19/18 14:14:43:91] Direct commit on master 921bde9140d1c271dbb0ec665f775c24847e2171 incremented base versions Patch, now 4.0.8
  INFO [11/19/18 14:14:43:92] Direct commit on master dedfec10c6920d09fbd73cdb995610f5a4ca81d4 incremented base versions Patch, now 4.0.9
  INFO [11/19/18 14:14:43:93] Direct commit on master 79c7e297fd982bed2b6853bebf93c33333ca1458 incremented base versions Patch, now 4.0.10
  INFO [11/19/18 14:14:43:95] Direct commit on master 692cc0ce53e2911ca43c8014c1a2c520f1f24aa1 incremented base versions Patch, now 4.0.11
  INFO [11/19/18 14:14:43:97] Direct commit on master 8b2657289662336fc9590deb05897cf7adbb0940 incremented base versions Patch, now 4.0.12
  INFO [11/19/18 14:14:43:98] Direct commit on master 681779212c7e8ad0d6327fd17c44f9de0a14b3c2 incremented base versions Patch, now 4.0.13
  INFO [11/19/18 14:14:43:98] 2 commits found between 681779212c7e8ad0d6327fd17c44f9de0a14b3c2 and 6b92f175c8c1d0f1a67e10f1b6197964e6fa6661
  INFO [11/19/18 14:14:43:98] Performing Minor increment for current branch
INFO [11/19/18 14:14:43:98] End: Using mainline development mode to calculate current version (Took: 304.95ms)
INFO [11/19/18 14:14:43:99] Begin: Getting version tags from branch 'refs/heads/develop'.
INFO [11/19/18 14:14:44:04] End: Getting version tags from branch 'refs/heads/develop'. (Took: 49.98ms)

GitVersionTask 4.0.0, config is just mode: Mainline

@wjrogers

This comment has been minimized.

Copy link
Contributor

commented Nov 19, 2018

Actually, I missed that last "Performing Minor increment"; it makes the final version 4.1.0-alpha.2, which is even more wrong. Now later commits to develop may have a lower version number than earlier ones!

wjrogers added a commit to wjrogers/GitVersion that referenced this issue Nov 26, 2018
Query the mainline commit log starting from mainline tip regardless of
the current branch. Stop considering mainline commits after the merge
root for the current branch (or, if the current branch has been merged
to mainline but has new commmits, the last commit that merged the
current branch into mainline).

fixes GitTools#1035
asbjornu added a commit to wjrogers/GitVersion that referenced this issue Feb 15, 2019
@arturcic arturcic modified the milestones: 4.0.0, 5.0.0 Feb 15, 2019
@arturcic arturcic added the Bug label Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.