public GetResponse <ResetResults> Reset( IGitRepository repo, GitPatcherVersioning patcherVersioning, CancellationToken cancel) { CheckoutRunnerBranch.Checkout(repo); var targets = GetRepoTarget.Get( repo, patcherVersioning); if (targets.Failed) { return(targets.BubbleFailure <ResetResults>()); } var commit = RetrieveCommit.TryGet( repo, targets.Value, patcherVersioning, cancel); if (commit.Failed) { return(commit.BubbleFailure <ResetResults>()); } cancel.ThrowIfCancellationRequested(); _logger.Information("Checking out {TargetSha}", targets.Value.TargetSha); repo.ResetHard(commit.Value); return(new ResetResults(targets.Value, commit.Value.CommitMessage, commit.Value.CommitDate)); }
public void TagTargetEmptyReturnsFail( [Frozen] IGitRepository repo, GetRepoTarget sut) { sut.Get(repo, new GitPatcherVersioning(PatcherVersioningEnum.Tag, string.Empty)) .Succeeded.Should().BeFalse(); }
public void TagPassesToRepo( [Frozen] IGitRepository repo, string target, GetRepoTarget sut) { sut.Get(repo, new GitPatcherVersioning(PatcherVersioningEnum.Tag, target)); repo.Received(1).TryGetTagSha(target, out Arg.Any <string?>()); }
public void TagTargetFetches( [Frozen] IGitRepository repo, string target, GetRepoTarget sut) { sut.Get(repo, new GitPatcherVersioning(PatcherVersioningEnum.Tag, target)); repo.Received(1).Fetch(); }
public void TryGetTagFailsReturnsFail( [Frozen] IGitRepository repo, string target, GetRepoTarget sut) { repo.TryGetTagSha(default !, out _).ReturnsForAnyArgs(false);