]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6064 Experimental fix for JGit concurrency issue
authorJulien HENRY <julien.henry@sonarsource.com>
Wed, 21 Jan 2015 08:40:48 +0000 (09:40 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 21 Jan 2015 08:56:03 +0000 (09:56 +0100)
plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/JGitBlameCommand.java

index 126615eec69283d51e967ab8900d966ca8b96ab8..12acbfe55b04f8ec32f0b8b57aa6ebea99c47de5 100644 (file)
@@ -89,10 +89,13 @@ public class JGitBlameCommand extends BlameCommand {
 
   private Repository buildRepository(File basedir) {
     try {
-      return new RepositoryBuilder()
+      Repository repo = new RepositoryBuilder()
         .findGitDir(basedir)
         .setMustExist(true)
         .build();
+      // SONAR-6064 Force initialization of shallow commits to avoid later concurrent modification issue
+      repo.getObjectDatabase().newReader().getShallowCommits();
+      return repo;
     } catch (IOException e) {
       throw new IllegalStateException("Unable to open Git repository", e);
     }