Skip to content
Permalink
Browse files
1030: Lots of "uncleanable" repos found in scratch dirs
Reviewed-by: ehelin
  • Loading branch information
erikj79 committed May 13, 2021
1 parent 3325d48 commit 183323f7be988d5df053a22180df5e6c2b96ef20
Showing 1 changed file with 10 additions and 1 deletion.
@@ -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) {

1 comment on commit 183323f

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 183323f May 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.