Skip to content

Dynamic Repository with GitHubFlow throws an exception #336

@MacDennis76

Description

@MacDennis76

I am testing the Dynamic Repository functionality in combination with GitHubFlow and the latest release of GitVersion 2.0.0

From the command line:
gitversion /url https://stash.test.nl/customer/project/repo.git /b feature-TOHISP-91 /u user /p passw

Result:

Trying to check out 'NextVersion.txt'
Working directory: D:\test_dynamicrepository
Running against branch: feature-TOHISP-91
GitHubFlow version strategy will be used
An unexpected error occurred:
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at GitVersion.NextVersionTxtFileFinder.TryGetNextVersion(SemanticVersion& semanticVersion) in c:\BuildAgent\work\68ea6bfb44e5afb\GitVersionCore\GitHubFlow\NextVersionTxtFileFinder.cs:line 19
at GitVersion.NextSemverCalculator.d__2.MoveNext() in c:\BuildAgent\work\68ea6bfb44e5afb\GitVersionCore\GitHubFlow\NextSemverCalculator.cs:line 62
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at GitVersion.BuildNumberCalculator.GetBuildNumber(GitVersionContext context) in c:\BuildAgent\work\68ea6bfb44e5afb\GitVersionCore\GitHubFlow\BuildNumberCalculator.cs:line 26
at GitVersion.Program.Run()

It fails at:
public bool TryGetNextVersion(out SemanticVersion semanticVersion)
{
var filePath = Path.Combine(repositoryDirectory, "NextVersion.txt");

The repositoryDirectory is equal to null. The reason seems to be that the dynamic repository is a bare repository. This variable is set earlier on to:
context.Repository.Info.WorkingDirectory

WorkingDirectory is part of LibGit2Sharp.

From their code:
///

    /// Gets the normalized path to the working directory.
    /// <para>
    ///   If the repository is bare, null is returned.
    /// </para>
    /// </summary>


    public virtual string WorkingDirectory { get; private set; }

Is this a known issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions