From 0d404034f90714281e1bcd61ae11f3f75628ad4e Mon Sep 17 00:00:00 2001 From: Matthias Langhard Date: Wed, 3 Nov 2021 08:28:52 +0100 Subject: [PATCH] feat: improving push-functionality --- src/Core/Commands/PushCommitsToRemote.cs | 1 + src/Core/Interfaces/IGitRepoWriteService.cs | 3 ++- .../Services/GitRepoWriteService.cs | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Core/Commands/PushCommitsToRemote.cs b/src/Core/Commands/PushCommitsToRemote.cs index 80daed5..e4e078e 100644 --- a/src/Core/Commands/PushCommitsToRemote.cs +++ b/src/Core/Commands/PushCommitsToRemote.cs @@ -26,6 +26,7 @@ namespace Application.Commands protected override async Task Handle(Command request, CancellationToken cancellationToken) { + await _gitRepoWriteService.PushTags(request.RepoPath); await _gitRepoWriteService.Push(request.RepoPath); } } diff --git a/src/Core/Interfaces/IGitRepoWriteService.cs b/src/Core/Interfaces/IGitRepoWriteService.cs index 4fd4722..e4e0bfc 100644 --- a/src/Core/Interfaces/IGitRepoWriteService.cs +++ b/src/Core/Interfaces/IGitRepoWriteService.cs @@ -5,6 +5,7 @@ namespace Application.Interfaces public interface IGitRepoWriteService { void AddTag(string repoPath, string tag); - Task Push(string repoPath); + Task PushTags(string repoPath); + Task Push(string repoPath); } } \ No newline at end of file diff --git a/src/Infrastructure/Services/GitRepoWriteService.cs b/src/Infrastructure/Services/GitRepoWriteService.cs index dc7a1e8..d113d88 100644 --- a/src/Infrastructure/Services/GitRepoWriteService.cs +++ b/src/Infrastructure/Services/GitRepoWriteService.cs @@ -14,12 +14,23 @@ namespace Infrastructure.Services repo.ApplyTag(tag); } - public async Task Push(string repoPath) + public async Task PushTags(string repoPath) { - await Cli.Wrap("git") + var result = await Cli.Wrap("git") .WithArguments("push --tags") .WithWorkingDirectory(repoPath) .ExecuteBufferedAsync(); + return result.StandardOutput.Trim(); + } + + public async Task Push(string repoPath) + { + var result = await Cli.Wrap("git") + .WithArguments("push") + .WithWorkingDirectory(repoPath) + .ExecuteBufferedAsync(); + + return result.StandardOutput.Trim(); } } } \ No newline at end of file