summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2018-08-24 18:25:28 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2018-08-25 07:55:55 +0200
commit6670ff16636f960b1e7c3ad9a1611c81727a974c (patch)
tree6a764f0f89143a26cd511a9d2e8626a052505713
parentc415e93e8a476e62a71f46b25467c97820f0e38c (diff)
parentdb6c2c2aa58f574383b51b3802e6817ac4cf8963 (diff)
downloadjgit-6670ff16636f960b1e7c3ad9a1611c81727a974c.tar.gz
jgit-6670ff16636f960b1e7c3ad9a1611c81727a974c.zip
Merge branch 'stable-4.10' into stable-4.11
* stable-4.10: Ignore API warnings Fix photon target platform to use photon version of org.eclipse.osgi Update Photon orbit repository to R20180606145124 Suppress warning for trying to delete non-empty directory Fix fetching with duplicate ref updates Fetch(Process): should tolerate duplicate refspecs FetchCommandTest: test add/update/delete fetch Change-Id: I47671108574fcd10fe016a58e38c038af54a6748 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target16
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target16
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target16
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target18
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20180606145124-Photon.tpd (renamed from org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20180302171354-Photon.tpd)16
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java159
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java32
12 files changed, 236 insertions, 52 deletions
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target
index e106012d19..0c1d5bb809 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target
@@ -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="1520121120">
+<target name="jgit-4.5" sequenceNumber="1535176347">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@@ -33,16 +33,16 @@
<unit id="org.apache.commons.logging.source" version="1.1.1.v201101211721"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.6.v20170210-0925"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.6.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20170210-0925"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20180410-1551"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20180410-1551"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
<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.core" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.core.source" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.library" version="1.3.0.v201505072020"/>
- <unit id="org.hamcrest.library.source" version="1.3.0.v201505072020"/>
+ <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"/>
+ <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
<unit id="javaewah" version="1.1.6.v20160919-1400"/>
<unit id="javaewah.source" version="1.1.6.v20160919-1400"/>
<unit id="org.objenesis" version="1.0.0.v201505121915"/>
@@ -65,7 +65,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/S20180302171354/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"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd
index e8d38ecc4e..c85343c9f9 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd
@@ -1,7 +1,7 @@
target "jgit-4.5" with source configurePhase
include "projects/jetty-9.4.8.tpd"
-include "orbit/S20180302171354-Photon.tpd"
+include "orbit/R20180606145124-Photon.tpd"
location "http://download.eclipse.org/releases/mars/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
index 0d29b80a75..e05c410128 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
@@ -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="1520121092">
+<target name="jgit-4.6" sequenceNumber="1535176335">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@@ -33,16 +33,16 @@
<unit id="org.apache.commons.logging.source" version="1.1.1.v201101211721"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.6.v20170210-0925"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.6.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20170210-0925"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20180410-1551"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20180410-1551"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
<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.core" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.core.source" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.library" version="1.3.0.v201505072020"/>
- <unit id="org.hamcrest.library.source" version="1.3.0.v201505072020"/>
+ <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"/>
+ <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
<unit id="javaewah" version="1.1.6.v20160919-1400"/>
<unit id="javaewah.source" version="1.1.6.v20160919-1400"/>
<unit id="org.objenesis" version="1.0.0.v201505121915"/>
@@ -65,7 +65,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/S20180302171354/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"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd
index a28f6cf5b8..3c2a910f8d 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd
@@ -1,7 +1,7 @@
target "jgit-4.6" with source configurePhase
include "projects/jetty-9.4.8.tpd"
-include "orbit/S20180302171354-Photon.tpd"
+include "orbit/R20180606145124-Photon.tpd"
location "http://download.eclipse.org/releases/neon/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
index e23499fbf2..20b0a294a6 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
@@ -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="1520121057">
+<target name="jgit-4.7" sequenceNumber="1535176314">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@@ -33,16 +33,16 @@
<unit id="org.apache.commons.logging.source" version="1.1.1.v201101211721"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.6.v20170210-0925"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.6.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20170210-0925"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20180410-1551"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20180410-1551"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
<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.core" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.core.source" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.library" version="1.3.0.v201505072020"/>
- <unit id="org.hamcrest.library.source" version="1.3.0.v201505072020"/>
+ <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"/>
+ <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
<unit id="javaewah" version="1.1.6.v20160919-1400"/>
<unit id="javaewah.source" version="1.1.6.v20160919-1400"/>
<unit id="org.objenesis" version="1.0.0.v201505121915"/>
@@ -65,7 +65,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/S20180302171354/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"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd
index 1901775106..4e543fffee 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd
@@ -1,7 +1,7 @@
target "jgit-4.7" with source configurePhase
include "projects/jetty-9.4.8.tpd"
-include "orbit/S20180302171354-Photon.tpd"
+include "orbit/R20180606145124-Photon.tpd"
location "http://download.eclipse.org/releases/oxygen/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
index dddd0da81e..b84fc208f7 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
@@ -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="1520121050">
+<target name="jgit-4.8" sequenceNumber="1535176301">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
@@ -33,16 +33,16 @@
<unit id="org.apache.commons.logging.source" version="1.1.1.v201101211721"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.6.v20170210-0925"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.6.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20170210-0925"/>
- <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20170210-0925"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.2.v20180410-1551"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20180410-1551"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
<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.core" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.core.source" version="1.3.0.v20180227-1814"/>
- <unit id="org.hamcrest.library" version="1.3.0.v201505072020"/>
- <unit id="org.hamcrest.library.source" version="1.3.0.v201505072020"/>
+ <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"/>
+ <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
<unit id="javaewah" version="1.1.6.v20160919-1400"/>
<unit id="javaewah.source" version="1.1.6.v20160919-1400"/>
<unit id="org.objenesis" version="1.0.0.v201505121915"/>
@@ -65,11 +65,11 @@
<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/S20180302171354/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"/>
- <repository location="http://download.eclipse.org/releases/oxygen/"/>
+ <repository location="http://download.eclipse.org/releases/photon/"/>
</location>
</locations>
</target>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd
index 2eb8f033b9..0ea2b99f32 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd
@@ -1,8 +1,8 @@
target "jgit-4.8" with source configurePhase
include "projects/jetty-9.4.8.tpd"
-include "orbit/S20180302171354-Photon.tpd"
+include "orbit/R20180606145124-Photon.tpd"
-location "http://download.eclipse.org/releases/oxygen/" {
+location "http://download.eclipse.org/releases/photon/" {
org.eclipse.osgi lazy
}
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20180302171354-Photon.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20180606145124-Photon.tpd
index 2db3457fa0..f4ec50dc79 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20180302171354-Photon.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20180606145124-Photon.tpd
@@ -1,7 +1,7 @@
-target "S20180302171354-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/S20180302171354/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]
@@ -12,16 +12,16 @@ location "http://download.eclipse.org/tools/orbit/downloads/drops/S2018030217135
org.apache.commons.logging.source [1.1.1.v201101211721,1.1.1.v201101211721]
org.apache.httpcomponents.httpcore [4.4.6.v20170210-0925,4.4.6.v20170210-0925]
org.apache.httpcomponents.httpcore.source [4.4.6.v20170210-0925,4.4.6.v20170210-0925]
- org.apache.httpcomponents.httpclient [4.5.2.v20170210-0925,4.5.2.v20170210-0925]
- org.apache.httpcomponents.httpclient.source [4.5.2.v20170210-0925,4.5.2.v20170210-0925]
+ org.apache.httpcomponents.httpclient [4.5.2.v20180410-1551,4.5.2.v20180410-1551]
+ org.apache.httpcomponents.httpclient.source [4.5.2.v20180410-1551,4.5.2.v20180410-1551]
org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815]
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.core [1.3.0.v20180227-1814,1.3.0.v20180227-1814]
- org.hamcrest.core.source [1.3.0.v20180227-1814,1.3.0.v20180227-1814]
- org.hamcrest.library [1.3.0.v201505072020,1.3.0.v201505072020]
- org.hamcrest.library.source [1.3.0.v201505072020,1.3.0.v201505072020]
+ 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]
+ org.hamcrest.library.source [1.3.0.v20180524-2246,1.3.0.v20180524-2246]
javaewah [1.1.6.v20160919-1400,1.1.6.v20160919-1400]
javaewah.source [1.1.6.v20160919-1400,1.1.6.v20160919-1400]
org.objenesis [1.0.0.v201505121915,1.0.0.v201505121915]
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java
index 83a0564c77..530fb1b2fe 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchCommandTest.java
@@ -45,7 +45,9 @@ package org.eclipse.jgit.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.Constants;
@@ -56,6 +58,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.FetchResult;
+import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.TagOpt;
import org.eclipse.jgit.transport.TrackingRefUpdate;
@@ -102,6 +105,91 @@ public class FetchCommandTest extends RepositoryTestCase {
}
@Test
+ public void fetchAddsBranches() throws Exception {
+ final String branch1 = "b1";
+ final String branch2 = "b2";
+ final String remoteBranch1 = "test/" + branch1;
+ final String remoteBranch2 = "test/" + branch2;
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef1 = remoteGit.branchCreate().setName(branch1).call();
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef2 = remoteGit.branchCreate().setName(branch2).call();
+
+ String spec = "refs/heads/*:refs/remotes/test/*";
+ git.fetch().setRemote("test").setRefSpecs(spec).call();
+ assertEquals(branchRef1.getObjectId(), db.resolve(remoteBranch1));
+ assertEquals(branchRef2.getObjectId(), db.resolve(remoteBranch2));
+ }
+
+ @Test
+ public void fetchDoesntDeleteBranches() throws Exception {
+ final String branch1 = "b1";
+ final String branch2 = "b2";
+ final String remoteBranch1 = "test/" + branch1;
+ final String remoteBranch2 = "test/" + branch2;
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef1 = remoteGit.branchCreate().setName(branch1).call();
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef2 = remoteGit.branchCreate().setName(branch2).call();
+
+ String spec = "refs/heads/*:refs/remotes/test/*";
+ git.fetch().setRemote("test").setRefSpecs(spec).call();
+ assertEquals(branchRef1.getObjectId(), db.resolve(remoteBranch1));
+ assertEquals(branchRef2.getObjectId(), db.resolve(remoteBranch2));
+
+ remoteGit.branchDelete().setBranchNames(branch1).call();
+ git.fetch().setRemote("test").setRefSpecs(spec).call();
+ assertEquals(branchRef1.getObjectId(), db.resolve(remoteBranch1));
+ assertEquals(branchRef2.getObjectId(), db.resolve(remoteBranch2));
+ }
+
+ @Test
+ public void fetchUpdatesBranches() throws Exception {
+ final String branch1 = "b1";
+ final String branch2 = "b2";
+ final String remoteBranch1 = "test/" + branch1;
+ final String remoteBranch2 = "test/" + branch2;
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef1 = remoteGit.branchCreate().setName(branch1).call();
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef2 = remoteGit.branchCreate().setName(branch2).call();
+
+ String spec = "refs/heads/*:refs/remotes/test/*";
+ git.fetch().setRemote("test").setRefSpecs(spec).call();
+ assertEquals(branchRef1.getObjectId(), db.resolve(remoteBranch1));
+ assertEquals(branchRef2.getObjectId(), db.resolve(remoteBranch2));
+
+ remoteGit.commit().setMessage("commit").call();
+ branchRef2 = remoteGit.branchCreate().setName(branch2).setForce(true).call();
+ git.fetch().setRemote("test").setRefSpecs(spec).call();
+ assertEquals(branchRef1.getObjectId(), db.resolve(remoteBranch1));
+ assertEquals(branchRef2.getObjectId(), db.resolve(remoteBranch2));
+ }
+
+ @Test
+ public void fetchPrunesBranches() throws Exception {
+ final String branch1 = "b1";
+ final String branch2 = "b2";
+ final String remoteBranch1 = "test/" + branch1;
+ final String remoteBranch2 = "test/" + branch2;
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef1 = remoteGit.branchCreate().setName(branch1).call();
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef2 = remoteGit.branchCreate().setName(branch2).call();
+
+ String spec = "refs/heads/*:refs/remotes/test/*";
+ git.fetch().setRemote("test").setRefSpecs(spec).call();
+ assertEquals(branchRef1.getObjectId(), db.resolve(remoteBranch1));
+ assertEquals(branchRef2.getObjectId(), db.resolve(remoteBranch2));
+
+ remoteGit.branchDelete().setBranchNames(branch1).call();
+ git.fetch().setRemote("test").setRefSpecs(spec)
+ .setRemoveDeletedRefs(true).call();
+ assertNull(db.resolve(remoteBranch1));
+ assertEquals(branchRef2.getObjectId(), db.resolve(remoteBranch2));
+ }
+
+ @Test
public void fetchShouldAutoFollowTag() throws Exception {
remoteGit.commit().setMessage("commit").call();
Ref tagRef = remoteGit.tag().setName("foo").call();
@@ -185,4 +273,75 @@ public class FetchCommandTest extends RepositoryTestCase {
assertEquals(RefUpdate.Result.FORCED, update.getResult());
assertEquals(tagRef2.getObjectId(), db.resolve(tagName));
}
+
+ @Test
+ public void fetchAddRefsWithDuplicateRefspec() throws Exception {
+ final String branchName = "branch";
+ final String remoteBranchName = "test/" + branchName;
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef = remoteGit.branchCreate().setName(branchName).call();
+
+ final String spec1 = "+refs/heads/*:refs/remotes/test/*";
+ final String spec2 = "refs/heads/*:refs/remotes/test/*";
+ final StoredConfig config = db.getConfig();
+ RemoteConfig remoteConfig = new RemoteConfig(config, "test");
+ remoteConfig.addFetchRefSpec(new RefSpec(spec1));
+ remoteConfig.addFetchRefSpec(new RefSpec(spec2));
+ remoteConfig.update(config);
+
+ git.fetch().setRemote("test").setRefSpecs(spec1).call();
+ assertEquals(branchRef.getObjectId(), db.resolve(remoteBranchName));
+ }
+
+ @Test
+ public void fetchPruneRefsWithDuplicateRefspec()
+ throws Exception {
+ final String branchName = "branch";
+ final String remoteBranchName = "test/" + branchName;
+ remoteGit.commit().setMessage("commit").call();
+ Ref branchRef = remoteGit.branchCreate().setName(branchName).call();
+
+ final String spec1 = "+refs/heads/*:refs/remotes/test/*";
+ final String spec2 = "refs/heads/*:refs/remotes/test/*";
+ final StoredConfig config = db.getConfig();
+ RemoteConfig remoteConfig = new RemoteConfig(config, "test");
+ remoteConfig.addFetchRefSpec(new RefSpec(spec1));
+ remoteConfig.addFetchRefSpec(new RefSpec(spec2));
+ remoteConfig.update(config);
+
+ git.fetch().setRemote("test").setRefSpecs(spec1).call();
+ assertEquals(branchRef.getObjectId(), db.resolve(remoteBranchName));
+
+ remoteGit.branchDelete().setBranchNames(branchName).call();
+ git.fetch().setRemote("test").setRefSpecs(spec1)
+ .setRemoveDeletedRefs(true).call();
+ assertNull(db.resolve(remoteBranchName));
+ }
+
+ @Test
+ public void fetchUpdateRefsWithDuplicateRefspec() throws Exception {
+ final String tagName = "foo";
+ remoteGit.commit().setMessage("commit").call();
+ Ref tagRef1 = remoteGit.tag().setName(tagName).call();
+ List<RefSpec> refSpecs = new ArrayList<>();
+ refSpecs.add(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
+ refSpecs.add(new RefSpec("+refs/tags/*:refs/tags/*"));
+ // Updating tags via the RefSpecs and setting TagOpt.FETCH_TAGS (or
+ // AUTO_FOLLOW) will result internally in *two* updates for the same
+ // ref.
+ git.fetch().setRemote("test").setRefSpecs(refSpecs)
+ .setTagOpt(TagOpt.AUTO_FOLLOW).call();
+ assertEquals(tagRef1.getObjectId(), db.resolve(tagName));
+
+ remoteGit.commit().setMessage("commit 2").call();
+ Ref tagRef2 = remoteGit.tag().setName(tagName).setForceUpdate(true)
+ .call();
+ FetchResult result = git.fetch().setRemote("test").setRefSpecs(refSpecs)
+ .setTagOpt(TagOpt.FETCH_TAGS).call();
+ assertEquals(2, result.getTrackingRefUpdates().size());
+ TrackingRefUpdate update = result
+ .getTrackingRefUpdate(Constants.R_TAGS + tagName);
+ assertEquals(RefUpdate.Result.FORCED, update.getResult());
+ assertEquals(tagRef2.getObjectId(), db.resolve(tagName));
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index 73ea77d47f..ad2d89afc5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -65,6 +65,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InterruptedIOException;
+import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.DigestInputStream;
@@ -1287,6 +1288,10 @@ public class RefDirectory extends RefDatabase {
for (int i = 0; i < depth; ++i) {
try {
Files.delete(dir.toPath());
+ } catch (DirectoryNotEmptyException e) {
+ // Don't log; normal case when there are other refs with the
+ // same prefix
+ break;
} catch (IOException e) {
LOG.warn("Unable to remove path {}", dir, e);
break;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
index fdb5adf94e..117e8447f2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -203,12 +203,10 @@ class FetchProcess {
((BatchingProgressMonitor) monitor).setDelayStart(
250, TimeUnit.MILLISECONDS);
}
- if (transport.isRemoveDeletedRefs())
+ if (transport.isRemoveDeletedRefs()) {
deleteStaleTrackingRefs(result, batch);
- for (TrackingRefUpdate u : localUpdates) {
- result.add(u);
- batch.addCommand(u.asReceiveCommand());
}
+ addUpdateBatchCommands(result, batch);
for (ReceiveCommand cmd : batch.getCommands()) {
cmd.updateType(walk);
if (cmd.getType() == UPDATE_NONFASTFORWARD
@@ -221,8 +219,11 @@ class FetchProcess {
if (cmd.getResult() == NOT_ATTEMPTED)
cmd.setResult(OK);
}
- } else
+ } else {
batch.execute(walk, monitor);
+ }
+ } catch (TransportException e) {
+ throw e;
} catch (IOException err) {
throw new TransportException(MessageFormat.format(
JGitText.get().failureUpdatingTrackingRef,
@@ -239,6 +240,23 @@ class FetchProcess {
}
}
+ private void addUpdateBatchCommands(FetchResult result,
+ BatchRefUpdate batch) throws TransportException {
+ Map<String, ObjectId> refs = new HashMap<>();
+ for (TrackingRefUpdate u : localUpdates) {
+ // Try to skip duplicates if they'd update to the same object ID
+ ObjectId existing = refs.get(u.getLocalName());
+ if (existing == null) {
+ refs.put(u.getLocalName(), u.getNewObjectId());
+ result.add(u);
+ batch.addCommand(u.asReceiveCommand());
+ } else if (!existing.equals(u.getNewObjectId())) {
+ throw new TransportException(MessageFormat
+ .format(JGitText.get().duplicateRef, u.getLocalName()));
+ }
+ }
+ }
+
private void fetchObjects(final ProgressMonitor monitor)
throws TransportException {
try {
@@ -479,12 +497,14 @@ class FetchProcess {
private void deleteStaleTrackingRefs(FetchResult result,
BatchRefUpdate batch) throws IOException {
+ final Set<Ref> processed = new HashSet<>();
for (final Ref ref : localRefs().values()) {
final String refname = ref.getName();
for (final RefSpec spec : toFetch) {
if (spec.matchDestination(refname)) {
final RefSpec s = spec.expandFromDestination(refname);
- if (result.getAdvertisedRef(s.getSource()) == null) {
+ if (result.getAdvertisedRef(s.getSource()) == null
+ && processed.add(ref)) {
deleteTrackingRef(result, batch, s, ref);
}
}