Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt to checkout a detached SHA on reclone #1991

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -642,11 +642,10 @@ public async ValueTask RepositoryRecloneJob(
await deleteTask;
}

IRepository newRepo;
try
{
using var cloneReporter = progressReporter.CreateSection("Cloning New Repository", 0.8);
newRepo = await instance.RepositoryManager.CloneRepository(
using var cloneReporter = progressReporter.CreateSection("Cloning New Repository", 0.9);
using var newRepo = await instance.RepositoryManager.CloneRepository(
origin,
oldReference,
currentModel.AccessUser,
Expand All @@ -671,19 +670,6 @@ await databaseContextFactory.UseContextTaskReturn(context =>

throw;
}

using (newRepo)
using (var checkoutReporter = progressReporter.CreateSection("Checking out previous Detached Commit", 0.1))
{
await newRepo.CheckoutObject(
oldSha,
currentModel.AccessUser,
currentModel.AccessToken,
false,
oldReference != null,
checkoutReporter,
cancellationToken);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ public async Task AbortLongCloneAndCloneSomethingQuick(Task<JobResponse> longClo
await ApiAssert.ThrowsException<ApiConflictException, RepositoryResponse>(() => Checkout(new RepositoryUpdateRequest { Reference = "master", CheckoutSha = "286bb75" }, false, false, cancellationToken), ErrorCode.RepoMismatchShaAndReference);
var updated = await Checkout(new RepositoryUpdateRequest { CheckoutSha = "286bb75" }, false, false, cancellationToken);

await RecloneTest(cancellationToken);

// Fake SHA
updated = await Checkout(new RepositoryUpdateRequest { CheckoutSha = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }, true, false, cancellationToken);

Expand All @@ -127,6 +125,8 @@ public async Task AbortLongCloneAndCloneSomethingQuick(Task<JobResponse> longClo
// Back
updated = await Checkout(new RepositoryUpdateRequest { Reference = "master" }, false, true, cancellationToken);

await RecloneTest(cancellationToken);

// enable the good shit if possible
if (!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("TGS_TEST_GITHUB_TOKEN"))
&& !(Boolean.TryParse(Environment.GetEnvironmentVariable("TGS_TEST_OD_EXCLUSIVE"), out var odExclusive) && odExclusive))
Expand Down
Loading