mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-16 12:32:10 +01:00
Stop modifying and reusing the global JavaHg RepositoryConfiguration singleton
I can't point to a specific error, but modifying a singleton and reusing it is a good way to get unexpected state. The extension adding won't collect additional state (it's add-if-not-present), but the underlying `java.util.HashMap` isn't threadsafe. Any differences in the environment map when this is called would alter that state of anything else that still held a configuration (and it also uses `HashMap`), and the pending changeset, encoding, and HgBin settings would be overwritten for everybody outright. There's only a default constructor for this class, so nothing to pass along in the constructor. I don't *think* this was the cause of the random auth failures mentioned in the previous commit, but it's easy to avoid these potential problems.
This commit is contained in:
@@ -59,7 +59,7 @@ public class HgRepositoryFactory {
|
||||
HgConfig config = configResolver.resolve(repository);
|
||||
File directory = config.getDirectory();
|
||||
|
||||
RepositoryConfiguration repoConfiguration = RepositoryConfiguration.DEFAULT;
|
||||
RepositoryConfiguration repoConfiguration = new RepositoryConfiguration();
|
||||
repoConfiguration.setHgrcPath(null);
|
||||
repoConfiguration.getEnvironment().putAll(environment);
|
||||
repoConfiguration.addExtension(HgFileviewExtension.class);
|
||||
|
||||
Reference in New Issue
Block a user