Skip to content

InvalidCastException on untagged branch though tag on merged branch exists #721

@heaths

Description

@heaths

Just starting to learn GitVersion and I'm probably doing something wrong, but seems the error could be more helpful. As it is, I'm not sure to which blog it refers (the tag perhaps)?

INFO [11/24/15 22:29:19:58] Using latest commit on specified branch
INFO [11/24/15 22:29:19:60] Running against branch: gitversion (c5f642417f33ba2e853bf10a6c8c445cb7f217f8)
INFO [11/24/15 22:29:19:62] Begin: Calculating base versions
  INFO [11/24/15 22:29:19:65] Fallback base version: 0.1.0 with commit count source e0d8bb5fb4fe7d1e6af1e3b97982bb2085a8
a4da
  INFO [11/24/15 22:29:19:70] NextVersion in GitVersionConfig.yaml: 3.0.0 with commit count source External Source
INFO [11/24/15 22:29:19:71] End: Calculating base versions (Took: 93.00ms)
ERROR [11/24/15 22:29:19:71] An unexpected error occurred:
System.InvalidCastException: Unable to cast object of type 'LibGit2Sharp.Blob' to type 'LibGit2Sharp.Commit'.
   at GitVersion.VersionCalculation.BaseVersionCalculators.TaggedCommitVersionStrategy.<>c__DisplayClass0_0.<GetVersions
>b__0(Tag tag)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitVersion.VersionCalculation.BaseVersionCalculators.TaggedCommitVersionStrategy.<GetVersions>d__0.MoveNext()
   at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitVersion.VersionCalculation.BaseVersionCalculator.GetBaseVersion(GitVersionContext context)
   at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion(GitVersionContext context)
   at GitVersion.GitVersionFinder.FindVersion(GitVersionContext context)
   at GitVersion.ExecuteCore.ExecuteGitVersion(IFileSystem fileSystem, String targetUrl, String dynamicRepositoryLocatio
n, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId)
   at GitVersion.SpecifiedArgumentRunner.Run(Arguments arguments, IFileSystem fileSystem)
   at GitVersion.Program.VerifyArgumentsAndRun()
INFO [11/24/15 22:29:19:71]
INFO [11/24/15 22:29:19:71] Here is the current git graph (please include in issue):
INFO [11/24/15 22:29:19:71] Showing max of 100 commits
INFO [11/24/15 22:29:19:78] * c5f6424 3 seconds ago  (HEAD -> gitversion)
| * f72b472 6 days ago  (origin/gulp)
| | * 3e4c90f 7 days ago  (origin/costing, costing)
| |/
|/|
* | 8ae03a8 3 weeks ago  (origin/appveyor, appveyor)
* | 37338c6 3 weeks ago
* | 95dfbf6 3 weeks ago
* | 419a0a0 5 weeks ago
* | e660bbc 5 weeks ago
|/
* 1b1eacc 3 months ago  (tag: v3.0.0-pre, origin/master, origin/develop, master, develop)
* 655c89e 3 months ago
* 78370f9 3 months ago
* d1483f2 3 months ago
*   fe0f456 3 months ago
|\
| *   392e431 3 months ago  (tag: v2.3.1.1)

I tried setting next-version but it still throws. If this branch needs tagging, an error message to that effect would help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions