]> source.dussan.org Git - jgit.git/commitdiff
Merge branch 'stable-4.9' into stable-4.10 31/127631/2
authorMatthias Sohn <matthias.sohn@sap.com>
Sat, 18 Aug 2018 11:51:00 +0000 (13:51 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 18 Aug 2018 11:51:00 +0000 (13:51 +0200)
* stable-4.9:
  Fix GC run in foreground to not use executor

Change-Id: Ib4d76125fca7eec9e88666688b5e614e7e20dde7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
1  2 
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java

index bca7076aca46d1d0d22e9d7c40fbe49910eb3078,e5fc0c5badfeae5d2760c4ade7b134c77c929e32..82458c1acf6a37fedb4930b389c1c4977e4084cd
@@@ -56,9 -54,7 +54,8 @@@ import java.text.ParseException
  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;
  
@@@ -104,22 -100,11 +101,11 @@@ class GcLog 
                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) {