From dbc7cc23904f52dac23eaed5aaa2e7337e0b1237 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 21 Jan 2015 09:40:48 +0100 Subject: [PATCH] SONAR-6064 Experimental fix for JGit concurrency issue --- .../java/org/sonar/plugins/scm/git/JGitBlameCommand.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); } -- 2.39.5