From: Julien HENRY Date: Wed, 21 Jan 2015 08:40:48 +0000 (+0100) Subject: SONAR-6064 Experimental fix for JGit concurrency issue X-Git-Tag: latest-silver-master-#65~162 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dbc7cc23904f52dac23eaed5aaa2e7337e0b1237;p=sonarqube.git SONAR-6064 Experimental fix for JGit concurrency issue --- diff --git a/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/JGitBlameCommand.java b/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/JGitBlameCommand.java index 126615eec69..12acbfe55b0 100644 --- a/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/JGitBlameCommand.java +++ b/plugins/sonar-git-plugin/src/main/java/org/sonar/plugins/scm/git/JGitBlameCommand.java @@ -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); }