Skip to content

GitVersion ignores version tag on the current commit when /nocache is specified #2089

@Inok

Description

@Inok

When I specify /nocache option, GitVersion ignores the version tag on the current commit.

With /nocache, the resulting version is invalid (0.1.0-...):

❯ git tag -l
MyApp_2020.0

❯ C:\Users\borisov\Desktop\GitVersion.exe /nocache /overrideconfig tag-prefix="MyApp_" /output buildserver
INFO [02/10/20 19:15:41:24] Working directory: C:\src\MyApp.NetCoreAppTemplate
INFO [02/10/20 19:15:41:24] IsDynamicGitRepository: False
INFO [02/10/20 19:15:41:26] Returning Project Root from DotGitDirectory: C:\src\MyApp.NetCoreAppTemplate\.git\ - C:\src\MyApp.NetCoreAppTemplate\
INFO [02/10/20 19:15:41:26] Running on Windows.
INFO [02/10/20 19:15:41:26] Project root is: C:\src\MyApp.NetCoreAppTemplate\
INFO [02/10/20 19:15:41:26] DotGit directory is: C:\src\MyApp.NetCoreAppTemplate\.git
INFO [02/10/20 19:15:41:38] Using latest commit on specified branch
INFO [02/10/20 19:15:41:41] Running against branch: master (e1f7b29b4709c0a3b30ffe6262a4a649e168d85a)
INFO [02/10/20 19:15:41:41] Begin: Calculating base versions
  INFO [02/10/20 19:15:41:42] Fallback base version: 0.1.0 with commit count source d37cc2a8f98107e690dcc52ab942d10e208c9aa7 (Incremented: None)
  INFO [02/10/20 19:15:41:45] Found multiple base versions which will produce the same SemVer (0.1.0), taking oldest source for commit counting (Fallback base version)
  INFO [02/10/20 19:15:41:45] Base version used: Fallback base version: 0.1.0 with commit count source d37cc2a8f98107e690dcc52ab942d10e208c9aa7 (Incremented: None)
  INFO [02/10/20 19:15:41:45] End: Calculating base versions (Took: 39.41ms)
  INFO [02/10/20 19:15:41:45] Skipping version increment
  INFO [02/10/20 19:15:41:45] 48 commits found between d37cc2a8f98107e690dcc52ab942d10e208c9aa7 and e1f7b29b4709c0a3b30ffe6262a4a649e168d85a
  INFO [02/10/20 19:15:41:46] Begin: Getting version tags from branch 'refs/heads/master'.
  INFO [02/10/20 19:15:41:46] End: Getting version tags from branch 'refs/heads/master'. (Took: 6.90ms)

Without /nocache, the resulting version is correct (2020.0.0):

❯ git tag -l
MyApp_2020.0

❯ C:\Users\borisov\Desktop\GitVersion.exe /overrideconfig tag-prefix="MyApp_" /output buildserver
INFO [02/10/20 19:19:15:66] Working directory: C:\src\MyApp.NetCoreAppTemplate
INFO [02/10/20 19:19:15:66] IsDynamicGitRepository: False
INFO [02/10/20 19:19:15:68] Returning Project Root from DotGitDirectory: C:\src\MyApp.NetCoreAppTemplate\.git\ - C:\src\MyApp.NetCoreAppTemplate\
INFO [02/10/20 19:19:15:68] Running on Windows.
INFO [02/10/20 19:19:15:68] Project root is: C:\src\MyApp.NetCoreAppTemplate\
INFO [02/10/20 19:19:15:68] DotGit directory is: C:\src\MyApp.NetCoreAppTemplate\.git
INFO [02/10/20 19:19:15:77] Begin: Loading version variables from disk cache
  INFO [02/10/20 19:19:15:78] Cache file C:\src\MyApp.NetCoreAppTemplate\.git\gitversion_cache\F38C72D0FE0FB0ADCD73C2DDB98FE9EC7E3490B4.yml not found.
  INFO [02/10/20 19:19:15:78] End: Loading version variables from disk cache (Took: 2.79ms)
  INFO [02/10/20 19:19:15:83] Using latest commit on specified branch
  INFO [02/10/20 19:19:15:85] Running against branch: master (e1f7b29b4709c0a3b30ffe6262a4a649e168d85a)
  INFO [02/10/20 19:19:15:85] Current commit is tagged with version 2020.0.0, version calculation is for metadata only.
  INFO [02/10/20 19:19:15:86] 0 commits found between e1f7b29b4709c0a3b30ffe6262a4a649e168d85a and e1f7b29b4709c0a3b30ffe6262a4a649e168d85a
  INFO [02/10/20 19:19:15:86] Begin: Calculating base versions
    INFO [02/10/20 19:19:15:87] Fallback base version: 0.1.0 with commit count source d37cc2a8f98107e690dcc52ab942d10e208c9aa7 (Incremented: None)    INFO [02/10/20 19:19:15:88] Git tag 'MyApp_2020.0': 2020.0.0 with commit count source e1f7b29b4709c0a3b30ffe6262a4a649e168d85a (Incremented: None)
    INFO [02/10/20 19:19:15:90] Found multiple base versions which will produce the same SemVer (2020.0.0), taking oldest source for commit counting (Git tag 'MyApp_2020.0')
    INFO [02/10/20 19:19:15:90] Base version used: Git tag 'MyApp_2020.0': 2020.0.0 with commit count source e1f7b29b4709c0a3b30ffe6262a4a649e168d85a (Incremented: None)
  INFO [02/10/20 19:19:15:90] End: Calculating base versions (Took: 34.46ms)
  INFO [02/10/20 19:19:15:90] Skipping version increment
  INFO [02/10/20 19:19:15:90] 0 commits found between e1f7b29b4709c0a3b30ffe6262a4a649e168d85a and e1f7b29b4709c0a3b30ffe6262a4a649e168d85a         INFO [02/10/20 19:19:15:90] Begin: Getting version tags from branch 'refs/heads/master'.
  INFO [02/10/20 19:19:15:91] End: Getting version tags from branch 'refs/heads/master'. (Took: 7.53ms)
  INFO [02/10/20 19:19:15:91] Begin: Creating dictionary
  INFO [02/10/20 19:19:15:92] End: Creating dictionary (Took: 2.91ms)
  INFO [02/10/20 19:19:15:92] Begin: Storing version variables to cache file C:\src\MyApp.NetCoreAppTemplate\.git\gitversion_cache\F38C72D0FE0FB0ADCD73C2DDB98FE9EC7E3490B4.yml
  INFO [02/10/20 19:19:15:92] End: Storing version variables to cache file C:\src\MyApp.NetCoreAppTemplate\.git\gitversion_cache\F38C72D0FE0FB0ADCD73C2DDB98FE9EC7E3490B4.yml (Took: 1.61ms)

The line Current commit is tagged with version 2020.0.0 ... appears in the log only when /nocache is not specified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions