Skip to content
Permalink
Browse files
Fetch PRs using the head hash
Reviewed-by: ehelin
  • Loading branch information
rwestberg committed Feb 11, 2020
1 parent a865b97 commit 21d6acf9a5f5ff6e255962a912941443b77f8324
Showing 1 changed file with 4 additions and 4 deletions.
@@ -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);
}
}

0 comments on commit 21d6acf

Please sign in to comment.