Skip to content

Commit 2b376b9

Browse files
committed
update from larc2
1 parent 0d7c910 commit 2b376b9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: lib/utils/GitUtil.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
import java.nio.file.Path;
44
import java.nio.file.Paths;
55
import java.util.Arrays;
6-
import java.util.Date;
7-
import java.util.HashSet;
86
import java.util.List;
9-
import java.util.Set;
107

118
public class GitUtil {
129

@@ -181,6 +178,17 @@ public static Boolean checkout(Path repoDir, String com, Boolean ifForce) {
181178
}
182179
pr = ProcessUtil.executeCMD(checkoutCMD, null, repoDir, 0);
183180

181+
if (pr.err.contains("fatal: index file smaller than expected")) {
182+
Path lockFilePath = Paths.get(repoDir.toString() + "/.git/index.lock");
183+
if (lockFilePath.toFile().exists()) {
184+
lockFilePath.toFile().delete();
185+
}
186+
Path indexFilePath = Paths.get(repoDir.toString() + "/.git/index");
187+
if (indexFilePath.toFile().exists()) {
188+
indexFilePath.toFile().delete();
189+
}
190+
}
191+
184192
if (pr.exitCode == 0) {
185193
return true;
186194
} else {

0 commit comments

Comments
 (0)