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

Fetch PRs using the head hash #417

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -99,7 +99,7 @@ private Repository cloneSeeded(Path path) throws IOException {
}

private NewClone fetchRef(Repository repository) throws IOException {
var fetchHead = repository.fetch(hostedRepository.url(), "+" + ref + ":" + ref);
var fetchHead = repository.fetch(hostedRepository.url(), "+" + ref + ":hostedrepositorypool");
return new NewClone(repository, fetchHead);
}

@@ -112,7 +112,7 @@ private NewClone materializeClone(Path path) throws IOException {
if (!localRepoInstance.isHealthy()) {
var preserveUnhealthy = seed.resolveSibling(seed.getFileName().toString() + "-unhealthy-" + UUID.randomUUID());
log.severe("Unhealthy local repository detected - preserved in: " + preserveUnhealthy);
Files.move(localRepoInstance.root(), preserveUnhealthy);
Files.move(path, preserveUnhealthy);
return fetchRef(cloneSeeded(path));
} else {
try {
@@ -121,7 +121,7 @@ private NewClone materializeClone(Path path) throws IOException {
} catch (IOException e) {
var preserveUnclean = seed.resolveSibling(seed.getFileName().toString() + "-unclean-" + UUID.randomUUID());
log.severe("Uncleanable local repository detected - preserved in: " + preserveUnclean);
Files.move(localRepoInstance.root(), preserveUnclean);
Files.move(path, preserveUnclean);
return fetchRef(cloneSeeded(path));
}
}
@@ -158,6 +158,6 @@ public Repository checkout(HostedRepository hostedRepository, String ref, Path p
}

public Repository checkout(PullRequest pr, Path path) throws IOException {
return checkout(pr.repository(), pr.sourceRef(), path);
return checkout(pr.repository(), pr.headHash().hex(), path);
}
}