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

1030: Lots of "uncleanable" repos found in scratch dirs #1156

Closed
wants to merge 2 commits 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
@@ -33,6 +33,8 @@
import java.util.logging.Logger;

public class HostedRepositoryPool {
private static final String CLONE_TMP_SUFFIX = ".clone-tmp";

private final Path seedStorage;
private final Logger log = Logger.getLogger("org.openjdk.skara.forge");

@@ -112,7 +114,14 @@ private Repository cloneSeeded(Path path, boolean allowStale, boolean bare) thro
refreshSeed(true);
var remote = allowStale ? seedUri() : hostedRepository.url();
log.info("Using seed folder " + seed + " when cloning into " + path + " from " + remote + (bare ? " (bare)" : ""));
return Repository.clone(remote, path, bare, seed);
var tmpClonePath = path.resolveSibling(path.getFileName() + CLONE_TMP_SUFFIX);
if (Files.exists(tmpClonePath)) {
log.fine("Found previous clone attempt " + tmpClonePath + " - deleting");
clearDirectory(tmpClonePath);
}
Repository.clone(remote, tmpClonePath, bare, seed);
Files.move(tmpClonePath, path);
return Repository.get(path).orElseThrow();
}

private void removeOldClone(Path path, String reason) {