import java.time.Instant;
import org.eclipse.jgit.api.errors.JGitInternalException;
- import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.ConfigConstants;
+import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.GitDateParser;
import org.eclipse.jgit.util.SystemReader;
return gcLogExpire;
}
- private boolean autoGcBlockedByOldLockFile(boolean background) {
+ private boolean autoGcBlockedByOldLockFile() {
try {
- FileTime lastModified = Files.getLastModifiedTime(logFile.toPath());
+ FileTime lastModified = Files.getLastModifiedTime(FileUtils.toPath(logFile));
if (lastModified.toInstant().compareTo(getLogExpiry()) > 0) {
// There is an existing log file, which is too recent to ignore
- if (!background) {
- try (BufferedReader reader = Files
- .newBufferedReader(FileUtils.toPath(logFile))) {
- char[] buf = new char[1000];
- int len = reader.read(buf, 0, 1000);
- String oldError = new String(buf, 0, len);
-
- throw new JGitInternalException(MessageFormat.format(
- JGitText.get().gcLogExists, oldError, logFile));
- }
- }
return true;
}
} catch (NoSuchFileException e) {