mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 21:16:52 +01:00
Always fixing never stopping
This commit is contained in:
@@ -23,7 +23,7 @@ namespace Tgstation.Server.Host.Components.Repository
|
||||
/// <param name="initialBranch">The branch to clone</param>
|
||||
/// <param name="accessString">The access string to clone from <paramref name="url"/></param>
|
||||
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
|
||||
/// <returns>The newly cloned <see cref="IRepository"/></returns>
|
||||
/// <returns>The newly cloned <see cref="IRepository"/>, <see langword="null"/> if one already exists</returns>
|
||||
Task<IRepository> CloneRepository(Uri url, string initialBranch, string accessString, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -55,8 +55,6 @@ namespace Tgstation.Server.Host.Components.Repository
|
||||
if (!await ioManager.DirectoryExists(".", cancellationToken).ConfigureAwait(false))
|
||||
try
|
||||
{
|
||||
await DeleteRepository(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
string path = null;
|
||||
@@ -85,6 +83,8 @@ namespace Tgstation.Server.Host.Components.Repository
|
||||
catch { }
|
||||
throw;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
return await LoadRepository(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,10 @@ namespace Tgstation.Server.Host.Components.Repository
|
||||
catch (RepositoryNotFoundException) { }
|
||||
}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current).ConfigureAwait(false);
|
||||
if (repo == null)
|
||||
{
|
||||
semaphore.Release();
|
||||
return null;
|
||||
}
|
||||
var localSemaphore = semaphore;
|
||||
return new Repository(repo, ioManager, eventConsumer, () =>
|
||||
{
|
||||
|
||||
@@ -141,13 +141,13 @@ namespace Tgstation.Server.Host.Controllers
|
||||
|
||||
using (var repo = await repoManager.LoadRepository(cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
if (repo == null)
|
||||
if (repo != null)
|
||||
//clone conflict
|
||||
return Conflict();
|
||||
|
||||
var job = new Models.Job
|
||||
{
|
||||
Description = String.Format(CultureInfo.InvariantCulture, "Clone branch {1} of repository {0}", origin, cloneBranch),
|
||||
Description = String.Format(CultureInfo.InvariantCulture, "Clone branch {1} of repository {0}", origin, cloneBranch ?? "master"),
|
||||
StartedBy = AuthenticationContext.User,
|
||||
CancelRightsType = RightsType.Repository,
|
||||
CancelRight = (int)RepositoryRights.CancelClone,
|
||||
@@ -219,7 +219,7 @@ namespace Tgstation.Server.Host.Controllers
|
||||
|
||||
using (var repo = await instanceManager.GetInstance(Instance).RepositoryManager.LoadRepository(cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
if (await PopulateApi(api, repo, currentModel.LastOriginCommitSha, null, cancellationToken).ConfigureAwait(false))
|
||||
if (repo != null && await PopulateApi(api, repo, currentModel.LastOriginCommitSha, null, cancellationToken).ConfigureAwait(false))
|
||||
await DatabaseContext.Save(cancellationToken).ConfigureAwait(false);
|
||||
return Json(api);
|
||||
}
|
||||
@@ -283,6 +283,8 @@ namespace Tgstation.Server.Host.Controllers
|
||||
|
||||
using (var repo = await instanceManager.GetInstance(Instance).RepositoryManager.LoadRepository(cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
if (repo == null)
|
||||
return StatusCode((int)HttpStatusCode.Gone);
|
||||
var startSha = repo.Head;
|
||||
|
||||
if (newTestMerges && !repo.IsGitHubRepository)
|
||||
|
||||
Reference in New Issue
Block a user