Skip to content

Commit 73c707d

Browse files
committed
Finally fix the bug where it wouldn't work on windows!
1 parent ff6b09d commit 73c707d

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • src/main/java/cam72cam/universalmodcore

src/main/java/cam72cam/universalmodcore/Util.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.apache.commons.io.FileUtils;
44
import org.eclipse.jgit.api.Git;
55
import org.eclipse.jgit.api.errors.GitAPIException;
6+
import org.eclipse.jgit.lib.Ref;
67
import org.eclipse.jgit.revwalk.RevCommit;
78

89
import java.io.File;
@@ -45,16 +46,17 @@ public static void gitClone(String repository, String branch, File clonePath, Bo
4546
System.out.println("Cloning " + uri + " into " + clonePath);
4647

4748

48-
Git.cloneRepository()
49+
try (Git repo = Git.cloneRepository()
4950
.setDirectory(clonePath)
5051
.setURI(uri)
5152
.setNoCheckout(true)
5253
.setCloneAllBranches(true)
53-
.call()
54-
.checkout()
55-
.setCreateBranch(true)
56-
.setName(branch)
57-
.setStartPoint("origin/" + branch)
58-
.call();
54+
.call()) {
55+
repo.checkout()
56+
.setCreateBranch(true)
57+
.setName(branch)
58+
.setStartPoint("origin/" + branch)
59+
.call();
60+
}
5961
}
6062
}

0 commit comments

Comments
 (0)