public async Task GitCheckoutAsync(Guid repositoryId, Guid branchId) { await Task.Run(async() => { var repository = await _repositoriesService.GetRepositoryAsync(repositoryId).ConfigureAwait(false); var branch = await _branchService.GetBranchFromRepositoryAsync(repositoryId, branchId).ConfigureAwait(false); await _gitService.CheckoutAsync(repository.Path, branch.Name); }); }
public async Task AddCommitAsync(Guid repositoryId, Guid branchId, Models.Commit commit) { var branches = await _branchService.GetBranchFromRepositoryAsync(repositoryId); branches.FirstOrDefault(b => b.Id == branchId).Commits.Add(commit); var repo = await _repositoriesService.GetRepositoryAsync(repositoryId).ConfigureAwait(false); repo.Branches = branches; await _context.Repositories.ReplaceOneAsync(r => r.Id == repositoryId, repo); }