aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-08-23 17:55:14 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-08-23 17:59:49 +0200
commite6619980ed2354e05760fd6fa0d3ba12831b8f8b (patch)
treecc7cd1f04b1d070f91c9dd4628cc0a162117dafe
parent2eb83f4b4ac77d1647cfcf0a06df44eb22f15da7 (diff)
parentf30382b1915723c526e50d7c9669c45a57c8ca86 (diff)
downloadjgit-e6619980ed2354e05760fd6fa0d3ba12831b8f8b.tar.gz
jgit-e6619980ed2354e05760fd6fa0d3ba12831b8f8b.zip
Merge branch 'stable-5.3' into stable-5.4
* stable-5.3: Prepare 5.3.5-SNAPSHOT builds JGit v5.3.4.201908231101-r Prepare 5.1.11-SNAPSHOT builds JGit v5.1.10.201908230655-r Use AtomicReferences to cache user and system level configs Fix copy-paste typo in CloneCommand#cleanup SystemReader: Use correct constructor of FileBasedConfig Change-Id: I4422632766fc5554a20f75346c5480b7fb611484 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.lfs/.settings/.api_filters2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.jgit/.settings/.api_filters2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java49
5 files changed, 32 insertions, 28 deletions
diff --git a/org.eclipse.jgit.lfs/.settings/.api_filters b/org.eclipse.jgit.lfs/.settings/.api_filters
index 5b8ece617a..def21cd7fe 100644
--- a/org.eclipse.jgit.lfs/.settings/.api_filters
+++ b/org.eclipse.jgit.lfs/.settings/.api_filters
@@ -3,7 +3,7 @@
<resource path="META-INF/MANIFEST.MF">
<filter id="924844039">
<message_arguments>
- <message_argument value="5.4.1"/>
+ <message_argument value="5.4.2"/>
<message_argument value="5.4.0"/>
</message_arguments>
</filter>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..ccd83fe883
--- /dev/null
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JGit Target Platform Bundle
+Bundle-SymbolicName: org.eclipse.jgit.target
+Bundle-Version: 5.4.2.qualifier
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index 5ca7c0f664..30ff73be2a 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -3,7 +3,7 @@
<resource path="META-INF/MANIFEST.MF">
<filter id="924844039">
<message_arguments>
- <message_argument value="5.4.1"/>
+ <message_argument value="5.4.2"/>
<message_argument value="5.4.0"/>
</message_arguments>
</filter>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
index 0248ba2793..9f63d0f005 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -713,7 +713,7 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
FileUtils.delete(gitDir, FileUtils.RECURSIVE
| FileUtils.SKIP_MISSING | FileUtils.IGNORE_ERRORS);
} else {
- deleteChildren(directory);
+ deleteChildren(gitDir);
}
}
} catch (IOException e) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
index 8431196cb5..cec75a26de 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
@@ -56,6 +56,7 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.TimeZone;
+import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.errors.CorruptObjectException;
@@ -97,9 +98,9 @@ public abstract class SystemReader {
private static class Default extends SystemReader {
private volatile String hostname;
- private volatile FileBasedConfig systemConfig;
+ private AtomicReference<FileBasedConfig> systemConfig = new AtomicReference<>();
- private volatile FileBasedConfig userConfig;
+ private volatile AtomicReference<FileBasedConfig> userConfig = new AtomicReference<>();
@Override
public String getenv(String variable) {
@@ -113,10 +114,13 @@ public abstract class SystemReader {
@Override
public FileBasedConfig openSystemConfig(Config parent, FS fs) {
- if (systemConfig == null) {
- systemConfig = createSystemConfig(parent, fs);
+ FileBasedConfig c = systemConfig.get();
+ if (c == null) {
+ systemConfig.compareAndSet(null,
+ createSystemConfig(parent, fs));
+ c = systemConfig.get();
}
- return systemConfig;
+ return c;
}
protected FileBasedConfig createSystemConfig(Config parent, FS fs) {
@@ -126,7 +130,7 @@ public abstract class SystemReader {
return new FileBasedConfig(parent, configFile, fs);
}
}
- return new FileBasedConfig(null, fs) {
+ return new FileBasedConfig(parent, null, fs) {
@Override
public void load() {
// empty, do not load
@@ -142,40 +146,35 @@ public abstract class SystemReader {
@Override
public FileBasedConfig openUserConfig(Config parent, FS fs) {
- if (userConfig == null) {
- File home = fs.userHome();
- userConfig = new FileBasedConfig(parent,
- new File(home, ".gitconfig"), fs); //$NON-NLS-1$
+ FileBasedConfig c = userConfig.get();
+ if (c == null) {
+ userConfig.compareAndSet(null, new FileBasedConfig(parent,
+ new File(fs.userHome(), ".gitconfig"), fs)); //$NON-NLS-1$
+ c = userConfig.get();
}
- return userConfig;
+ return c;
}
@Override
public StoredConfig getSystemConfig()
throws IOException, ConfigInvalidException {
- if (systemConfig == null) {
- systemConfig = createSystemConfig(null, FS.DETECTED);
- }
- if (systemConfig.isOutdated()) {
+ FileBasedConfig c = openSystemConfig(null, FS.DETECTED);
+ if (c.isOutdated()) {
LOG.debug("loading system config {}", systemConfig); //$NON-NLS-1$
- systemConfig.load();
+ c.load();
}
- return systemConfig;
+ return c;
}
@Override
public StoredConfig getUserConfig()
throws IOException, ConfigInvalidException {
- if (userConfig == null) {
- userConfig = openUserConfig(getSystemConfig(), FS.DETECTED);
- } else {
- getSystemConfig();
- }
- if (userConfig.isOutdated()) {
+ FileBasedConfig c = openUserConfig(getSystemConfig(), FS.DETECTED);
+ if (c.isOutdated()) {
LOG.debug("loading user config {}", userConfig); //$NON-NLS-1$
- userConfig.load();
+ c.load();
}
- return userConfig;
+ return c;
}
@Override