private static VersionNumber GenerateDevelopVersionNumber(
     IGitRepoReader repo,
     DevelopBranchInfo develop,
     string headCommitHash) =>
     new VersionNumber(
         repo.CurrentCoreVersion.Major,
         repo.CurrentCoreVersion.Minor + 1,
         0,
         develop.DeterminePreReleaseLabel(repo.CommitCountDevelopSinceLastMinorCoreVersion),
         headCommitHash);
        internal static VersionNumber GenerateVersionNumber(IGitRepoReader repo)
        {
            var currentBranch  = repo.CurrentBranch;
            var headCommitHash = repo.HeadCommitHash.Length > Constants.BuildMetadataHashLength
                ? repo.HeadCommitHash.Substring(0, Constants.BuildMetadataHashLength)
                : repo.HeadCommitHash;
            var tagOnHead = repo.TagOnHead;

            return(currentBranch switch
            {
                FeatureBranchInfo feature => GenerateFeatureVersionNumber(repo, feature, headCommitHash),
                ReleaseCandidateBranchInfo releaseCandidate => GenerateReleaseCandidateVersionNumber(repo, releaseCandidate, headCommitHash),
                DevelopBranchInfo develop => GenerateDevelopVersionNumber(repo, develop, headCommitHash),
                MasterBranchInfo _ when TagOnHeadIsMajorMinorPatch(tagOnHead) => VersionNumber.Parse(tagOnHead.FriendlyName),
                _ => throw new ArgumentOutOfRangeException(
                    $"'{currentBranch.Name}' is not a branch that is supported for automated version generation, please tag the commit manualy.",
                    nameof(currentBranch.Name))
            });