Esempio n. 1
0
        public override IEnumerable <BaseVersion> GetVersions()
        {
            var currentBranchTip = Context.CurrentBranch.Tip;

            if (currentBranchTip == null)
            {
                throw new GitVersionException("No commits found on the current branch.");
            }

            var baseVersionSource = repositoryMetadataProvider.GetBaseVersionSource(currentBranchTip);

            yield return(new BaseVersion("Fallback base version", false, new SemanticVersion(minor: 1), baseVersionSource, null));
        }
        public override IEnumerable <BaseVersion> GetVersions()
        {
            Commit baseVersionSource;
            var    currentBranchTip = Context.CurrentBranch.Tip;

            try
            {
                baseVersionSource = repositoryMetadataProvider.GetBaseVersionSource(currentBranchTip);
            }
            catch (NotFoundException exception)
            {
                throw new GitVersionException($"Can't find commit {currentBranchTip.Sha}. Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.", exception);
            }

            yield return(new BaseVersion("Fallback base version", false, new SemanticVersion(minor: 1), baseVersionSource, null));
        }