Nullify IRepositoryManager

This commit is contained in:
Jordan Dominion
2023-12-23 11:36:50 -05:00
parent 9e761240a3
commit 9aaad784ac
3 changed files with 13 additions and 12 deletions
@@ -159,7 +159,7 @@ namespace Tgstation.Server.Host.Components.Engine
Logger.LogTrace("OD repo seems to already exist, attempting load and fetch...");
repo = await repositoryManager.LoadRepository(cancellationToken);
await repo.FetchOrigin(
await repo!.FetchOrigin(
progressSection1,
null,
null,
@@ -514,6 +514,9 @@ namespace Tgstation.Server.Host.Components
Job compileProcessJob;
using (var repo = await RepositoryManager.LoadRepository(cancellationToken))
{
if (repo == null)
throw new JobException(Api.Models.ErrorCode.RepoMissing);
var deploySha = repo.Head;
if (deploySha == null)
{
@@ -4,8 +4,6 @@ using System.Threading.Tasks;
using Tgstation.Server.Host.Jobs;
#nullable disable
namespace Tgstation.Server.Host.Components.Repository
{
/// <summary>
@@ -28,25 +26,25 @@ namespace Tgstation.Server.Host.Components.Repository
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
/// <returns>A <see cref="ValueTask{TResult}"/> resulting in the loaded <see cref="IRepository"/> if it exists, <see langword="null"/> otherwise.</returns>
ValueTask<IRepository> LoadRepository(CancellationToken cancellationToken);
ValueTask<IRepository?> LoadRepository(CancellationToken cancellationToken);
/// <summary>
/// Clone the repository at <paramref name="url"/>.
/// </summary>
/// <param name="url">The <see cref="Uri"/> of the remote repository to clone.</param>
/// <param name="initialBranch">The branch to clone.</param>
/// <param name="username">The username to clone from <paramref name="url"/>.</param>
/// <param name="password">The password to clone from <paramref name="url"/>.</param>
/// <param name="initialBranch">The optional branch to clone.</param>
/// <param name="username">The optional username to clone from <paramref name="url"/>.</param>
/// <param name="password">The optional password to clone from <paramref name="url"/>.</param>
/// <param name="progressReporter">The optional <see cref="JobProgressReporter"/> for progress of the clone.</param>
/// <param name="recurseSubmodules">If submodules should be recusively cloned and initialized.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
/// <returns>A <see cref="ValueTask{TResult}"/> resulting i the newly cloned <see cref="IRepository"/>, <see langword="null"/> if one already exists.</returns>
ValueTask<IRepository> CloneRepository(
ValueTask<IRepository?> CloneRepository(
Uri url,
string initialBranch,
string username,
string password,
JobProgressReporter progressReporter,
string? initialBranch,
string? username,
string? password,
JobProgressReporter? progressReporter,
bool recurseSubmodules,
CancellationToken cancellationToken);