Merge branch 'stable-5.0'

* stable-5.0:
  Update to latest Photon Orbit R20180606145124
  Ensure index change event is fired when index snapshot changed

Change-Id: I8724fc92999d2bc0f8bde5e401156738dd9f1ee6
Signed-off-by: Jonathan Nieder <jrn@google.com>
This commit is contained in:
Jonathan Nieder 2018-06-07 22:36:00 -07:00
commit c86c1d5549
10 changed files with 45 additions and 23 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
<target name="jgit-4.5" sequenceNumber="1527855129">
<target name="jgit-4.5" sequenceNumber="1528375371">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@ -39,6 +39,7 @@
<unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
<unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
<unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
<unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
@ -65,7 +66,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="com.jcraft.jzlib" version="1.1.1.v201205102305"/>
<unit id="com.jcraft.jzlib.source" version="1.1.1.v201205102305"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180531190352/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.5" with source configurePhase
include "projects/jetty-9.4.8.tpd"
include "orbit/R20180531190352-Photon.tpd"
include "orbit/R20180606145124-Photon.tpd"
location "http://download.eclipse.org/releases/mars/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
<target name="jgit-4.6" sequenceNumber="1527855115">
<target name="jgit-4.6" sequenceNumber="1528375359">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@ -39,6 +39,7 @@
<unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
<unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
<unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
<unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
@ -65,7 +66,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="com.jcraft.jzlib" version="1.1.1.v201205102305"/>
<unit id="com.jcraft.jzlib.source" version="1.1.1.v201205102305"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180531190352/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.6" with source configurePhase
include "projects/jetty-9.4.8.tpd"
include "orbit/R20180531190352-Photon.tpd"
include "orbit/R20180606145124-Photon.tpd"
location "http://download.eclipse.org/releases/neon/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
<target name="jgit-4.7" sequenceNumber="1527855092">
<target name="jgit-4.7" sequenceNumber="1528375339">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@ -39,6 +39,7 @@
<unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
<unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
<unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
<unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
@ -65,7 +66,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="com.jcraft.jzlib" version="1.1.1.v201205102305"/>
<unit id="com.jcraft.jzlib.source" version="1.1.1.v201205102305"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180531190352/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.7" with source configurePhase
include "projects/jetty-9.4.8.tpd"
include "orbit/R20180531190352-Photon.tpd"
include "orbit/R20180606145124-Photon.tpd"
location "http://download.eclipse.org/releases/oxygen/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/mbarbero/fr.obeo.releng.targetplatform -->
<target name="jgit-4.8" sequenceNumber="1527855087">
<target name="jgit-4.8" sequenceNumber="1528373976">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@ -39,6 +39,7 @@
<unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
<unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
<unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
<unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
<unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
@ -65,7 +66,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="com.jcraft.jzlib" version="1.1.1.v201205102305"/>
<unit id="com.jcraft.jzlib.source" version="1.1.1.v201205102305"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180531190352/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.8" with source configurePhase
include "projects/jetty-9.4.8.tpd"
include "orbit/R20180531190352-Photon.tpd"
include "orbit/R20180606145124-Photon.tpd"
location "http://download.eclipse.org/releases/oxygen/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
target "R20180531190352-Photon" with source configurePhase
target "R20180606145124-Photon" with source configurePhase
// see http://download.eclipse.org/tools/orbit/downloads/
location "http://download.eclipse.org/tools/orbit/downloads/drops/R20180531190352/repository" {
location "http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository" {
org.apache.ant [1.9.6.v201510161327,1.9.6.v201510161327]
org.apache.ant.source [1.9.6.v201510161327,1.9.6.v201510161327]
org.apache.commons.codec [1.9.0.v20170208-1614,1.9.0.v20170208-1614]
@ -18,6 +18,7 @@ location "http://download.eclipse.org/tools/orbit/downloads/drops/R2018053119035
org.apache.log4j.source [1.2.15.v201012070815,1.2.15.v201012070815]
org.kohsuke.args4j [2.33.0.v20160323-2218,2.33.0.v20160323-2218]
org.kohsuke.args4j.source [2.33.0.v20160323-2218,2.33.0.v20160323-2218]
org.hamcrest [1.1.0.v20090501071000,1.1.0.v20090501071000]
org.hamcrest.core [1.3.0.v20180420-1519,1.3.0.v20180420-1519]
org.hamcrest.core.source [1.3.0.v20180420-1519,1.3.0.v20180420-1519]
org.hamcrest.library [1.3.0.v20180524-2246,1.3.0.v20180524-2246]

View File

@ -56,7 +56,7 @@
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.api.errors.JGitInternalException;
@ -125,7 +125,10 @@ public class FileRepository extends Repository {
private final RefDatabase refs;
private final ObjectDirectory objectDatabase;
private AtomicReference<FileSnapshot> snapshot = new AtomicReference<>();
private final ReentrantLock snapshotLock = new ReentrantLock();
// protected by snapshotLock
private FileSnapshot snapshot;
/**
* Construct a representation of a Git repository.
@ -240,8 +243,9 @@ public void onConfigChanged(ConfigChangedEvent event) {
Long.valueOf(repositoryFormatVersion)));
}
if (!isBare())
snapshot.getAndSet(FileSnapshot.save(getIndexFile()));
if (!isBare()) {
snapshot = FileSnapshot.save(getIndexFile());
}
}
private void loadSystemConfig() throws IOException {
@ -549,17 +553,30 @@ private void detectIndexChanges() {
}
File indexFile = getIndexFile();
if (snapshot.get() == null) {
snapshot.getAndSet(FileSnapshot.save(indexFile));
} else if (snapshot.get().isModified(indexFile)) {
notifyIndexChanged(false);
snapshotLock.lock();
try {
if (snapshot == null) {
snapshot = FileSnapshot.save(indexFile);
} else if (snapshot.isModified(indexFile)) {
snapshotLock.unlock();
notifyIndexChanged(false);
}
} finally {
if (snapshotLock.isHeldByCurrentThread()) {
snapshotLock.unlock();
}
}
}
/** {@inheritDoc} */
@Override
public void notifyIndexChanged(boolean internal) {
snapshot.getAndSet(FileSnapshot.save(getIndexFile()));
snapshotLock.lock();
try {
snapshot = FileSnapshot.save(getIndexFile());
} finally {
snapshotLock.unlock();
}
fireEvent(new IndexChangedEvent(internal));
}