public static int GetHeight(ManagedGitContext context, Func <GitCommit, bool>?continueStepping = null)
        {
            Verify.Operation(context.Commit.HasValue, "No commit is selected.");
            var tracker = new GitWalkTracker(context);

            return(GetCommitHeight(context.Repository, context.Commit.Value, tracker, continueStepping));
        }
        internal static int GetVersionHeight(ManagedGitContext context, Version?baseVersion = null)
        {
            if (context.Commit is null)
            {
                return(0);
            }

            var tracker = new GitWalkTracker(context);

            var versionOptions = tracker.GetVersion(context.Commit.Value);

            if (versionOptions is null)
            {
                return(0);
            }

            var baseSemVer =
                baseVersion is not null?SemanticVersion.Parse(baseVersion.ToString()) :
                    versionOptions.Version ?? SemVer0;

            var versionHeightPosition = versionOptions.VersionHeightPosition;

            if (versionHeightPosition.HasValue)
            {
                int height = GetHeight(context, c => CommitMatchesVersion(c, baseSemVer, versionHeightPosition.Value, tracker));
                return(height);
            }

            return(0);
        }
 internal GitWalkTracker(ManagedGitContext context)
 {
     this.context = context;
 }