summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WORKSPACE50
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.target54
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.5.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target54
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target54
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target57
-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/S20180730183850-2018-09.tpd (renamed from org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20180606145124-Photon.tpd)24
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.11.tpd20
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.8.tpd20
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java94
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcDeleteEmptyRefsFoldersTest.java36
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java39
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java10
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java1
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java284
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java2
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FilterCommandsTest.java2
-rw-r--r--org.eclipse.jgit/.settings/.api_filters14
-rw-r--r--org.eclipse.jgit/pom.xml4
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java58
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java91
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java91
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java22
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java122
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/CapabilitiesV2Request.java72
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java16
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java134
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Hook.java82
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java94
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java2
-rw-r--r--pom.xml9
46 files changed, 1301 insertions, 411 deletions
diff --git a/WORKSPACE b/WORKSPACE
index 0fff5f95ac..3f36b34721 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -11,8 +11,8 @@ load(
maven_jar(
name = "jsch",
- artifact = "com.jcraft:jsch:0.1.53",
- sha1 = "658b682d5c817b27ae795637dfec047c63d29935",
+ artifact = "com.jcraft:jsch:0.1.54",
+ sha1 = "da3584329a263616e277e15462b387addd1b208d",
)
maven_jar(
@@ -29,26 +29,26 @@ maven_jar(
maven_jar(
name = "httpclient",
- artifact = "org.apache.httpcomponents:httpclient:4.5.2",
- sha1 = "733db77aa8d9b2d68015189df76ab06304406e50",
+ artifact = "org.apache.httpcomponents:httpclient:4.5.5",
+ sha1 = "1603dfd56ebcd583ccdf337b6c3984ac55d89e58",
)
maven_jar(
name = "httpcore",
- artifact = "org.apache.httpcomponents:httpcore:4.4.6",
- sha1 = "e3fd8ced1f52c7574af952e2e6da0df8df08eb82",
+ artifact = "org.apache.httpcomponents:httpcore:4.4.9",
+ sha1 = "a86ce739e5a7175b4b234c290a00a5fdb80957a0",
)
maven_jar(
name = "commons_codec",
- artifact = "commons-codec:commons-codec:1.4",
- sha1 = "4216af16d38465bbab0f3dff8efa14204f7a399a",
+ artifact = "commons-codec:commons-codec:1.10",
+ sha1 = "4b95f4897fa13f2cd904aee711aeafc0c5295cd8",
)
maven_jar(
name = "commons_logging",
- artifact = "commons-logging:commons-logging:1.1.3",
- sha1 = "f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f",
+ artifact = "commons-logging:commons-logging:1.2",
+ sha1 = "4bfc12adfe4842bf07b657f0369c4cb522955686",
)
maven_jar(
@@ -89,8 +89,8 @@ maven_jar(
maven_jar(
name = "junit",
- artifact = "junit:junit:4.11",
- sha1 = "4e031bb61df09069aeb2bffb4019e7a5034a4ee0",
+ artifact = "junit:junit:4.12",
+ sha1 = "2973d150c0dc1fefe998f834810d68f278ea58ec",
)
maven_jar(
@@ -111,46 +111,46 @@ maven_jar(
sha1 = "3edcfe49d2c6053a70a2a47e4e1c2f94998a49cf",
)
-JETTY_VER = "9.4.8.v20171121"
+JETTY_VER = "9.4.11.v20180605"
maven_jar(
name = "jetty_servlet",
artifact = "org.eclipse.jetty:jetty-servlet:" + JETTY_VER,
- sha1 = "bbbb9b5de08f468c7b9b3de6aea0b098d2c679b6",
- src_sha1 = "6ef1e65a5af7ab2d79ba6043923affdaeaafb1e5",
+ sha1 = "66d31900fcfc70e3666f0b3335b6660635154f98",
+ src_sha1 = "930c50de49b9c258d5f0329426cbcac4d3143497",
)
maven_jar(
name = "jetty_security",
artifact = "org.eclipse.jetty:jetty-security:" + JETTY_VER,
- sha1 = "e8350eec683b55494287f06740543e4be6f75425",
- src_sha1 = "e3a879d8675fa10bc305e7a59006f1d09db04a68",
+ sha1 = "926def86d31ee07ca4b4658833dc6ee6918b8e86",
+ src_sha1 = "019bc7c2a366cbb201950f24dd64d9d9a49b6840",
)
maven_jar(
name = "jetty_server",
artifact = "org.eclipse.jetty:jetty-server:" + JETTY_VER,
- sha1 = "34614bd9a29de57ef28ca31f1f2b49a412af196d",
- src_sha1 = "fef49ac6b2bbc6d142dc0be34f68f0fb0792d52b",
+ sha1 = "58353c2f27515b007fc83ae22002feb34fc24714",
+ src_sha1 = "e7d832d74df616137755996b41bc28bb82b3bc42",
)
maven_jar(
name = "jetty_http",
artifact = "org.eclipse.jetty:jetty-http:" + JETTY_VER,
- sha1 = "9879d6c4e37400bf43f0cd4b3c6e34a3ba409864",
- src_sha1 = "5e746cd0ccb732eef0427c8c4b9dcb034e26c61b",
+ sha1 = "20c35f5336befe35b0bd5c4a63e07170fe7872d7",
+ src_sha1 = "5bc30d1f7e8c4456c22cc85999b8cafd3741bdff",
)
maven_jar(
name = "jetty_io",
artifact = "org.eclipse.jetty:jetty-io:" + JETTY_VER,
- sha1 = "d3fe2dfa62f52ee91ff07cb359f63387e0e30b40",
- src_sha1 = "41f25e1e1bba14ab0d3415488fa189f09c27a1cf",
+ sha1 = "d164de1dac18c4ca80a1b783d879c97449909c3b",
+ src_sha1 = "02c0caba292b1cb74cec1d36c6f91dc863c89b5a",
)
maven_jar(
name = "jetty_util",
artifact = "org.eclipse.jetty:jetty-util:" + JETTY_VER,
- sha1 = "d6ec1a1613c7fa72aa6bf5d8c204750afbc3df3b",
- src_sha1 = "a74ecb43f96b2e21852f6908604316d7348a16ad",
+ sha1 = "f0f25aa2f27d618a04bc7356fa247ae4a05245b3",
+ src_sha1 = "4e5c4c483cfd9804c2fc5d5751866243bbb9d740",
)
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 9fab245502..9ae9a28491 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,40 +1,40 @@
<?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="1528375371">
+<target name="jgit-4.5" sequenceNumber="1534608629">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.8.v20171121"/>
- <repository id="jetty-9.4.8" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.8.v20171121"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.11.v20180605"/>
+ <repository id="jetty-9.4.11" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.11.v20180605"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.9.6.v201510161327"/>
<unit id="org.apache.ant.source" version="1.9.6.v201510161327"/>
- <unit id="org.apache.commons.codec" version="1.9.0.v20170208-1614"/>
- <unit id="org.apache.commons.codec.source" version="1.9.0.v20170208-1614"/>
+ <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
+ <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.15.0.v20180119-1613"/>
<unit id="org.apache.commons.compress.source" version="1.15.0.v20180119-1613"/>
- <unit id="org.apache.commons.logging" version="1.1.1.v201101211721"/>
- <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.v20180410-1551"/>
- <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20180410-1551"/>
+ <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore" version="4.4.9.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.9.v20180409-1525"/>
<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"/>
@@ -66,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/R20180606145124/repository"/>
+ <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20180730183850/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 c85343c9f9..dc27968ec8 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/R20180606145124-Photon.tpd"
+include "projects/jetty-9.4.11.tpd"
+include "orbit/S20180730183850-2018-09.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 909b3307e0..6a6ea8d0a5 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,40 +1,40 @@
<?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="1528375359">
+<target name="jgit-4.6" sequenceNumber="1534608635">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.8.v20171121"/>
- <repository id="jetty-9.4.8" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.8.v20171121"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.11.v20180605"/>
+ <repository id="jetty-9.4.11" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.11.v20180605"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.9.6.v201510161327"/>
<unit id="org.apache.ant.source" version="1.9.6.v201510161327"/>
- <unit id="org.apache.commons.codec" version="1.9.0.v20170208-1614"/>
- <unit id="org.apache.commons.codec.source" version="1.9.0.v20170208-1614"/>
+ <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
+ <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.15.0.v20180119-1613"/>
<unit id="org.apache.commons.compress.source" version="1.15.0.v20180119-1613"/>
- <unit id="org.apache.commons.logging" version="1.1.1.v201101211721"/>
- <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.v20180410-1551"/>
- <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20180410-1551"/>
+ <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore" version="4.4.9.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.9.v20180409-1525"/>
<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"/>
@@ -66,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/R20180606145124/repository"/>
+ <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20180730183850/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 3c2a910f8d..4d4cf5a90c 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/R20180606145124-Photon.tpd"
+include "projects/jetty-9.4.11.tpd"
+include "orbit/S20180730183850-2018-09.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 8b064bc1ce..c271a1c896 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,40 +1,40 @@
<?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="1528375339">
+<target name="jgit-4.7" sequenceNumber="1534608613">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.8.v20171121"/>
- <repository id="jetty-9.4.8" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.8.v20171121"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.11.v20180605"/>
+ <repository id="jetty-9.4.11" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.11.v20180605"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.9.6.v201510161327"/>
<unit id="org.apache.ant.source" version="1.9.6.v201510161327"/>
- <unit id="org.apache.commons.codec" version="1.9.0.v20170208-1614"/>
- <unit id="org.apache.commons.codec.source" version="1.9.0.v20170208-1614"/>
+ <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
+ <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.15.0.v20180119-1613"/>
<unit id="org.apache.commons.compress.source" version="1.15.0.v20180119-1613"/>
- <unit id="org.apache.commons.logging" version="1.1.1.v201101211721"/>
- <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.v20180410-1551"/>
- <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.2.v20180410-1551"/>
+ <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore" version="4.4.9.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.9.v20180409-1525"/>
<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"/>
@@ -66,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/R20180606145124/repository"/>
+ <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20180730183850/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 4e543fffee..d946ecbea9 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/R20180606145124-Photon.tpd"
+include "projects/jetty-9.4.11.tpd"
+include "orbit/S20180730183850-2018-09.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 6f57c9d6a1..86342dde54 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,38 +1,40 @@
<?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="1528872727">
+<target name="jgit-4.8" sequenceNumber="1534608610">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util" version="9.4.8.v20171121"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.8.v20171121"/>
- <repository id="jetty-9.4.8" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.8.v20171121"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.11.v20180605"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.11.v20180605"/>
+ <repository id="jetty-9.4.11" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.11.v20180605"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.9.6.v201510161327"/>
<unit id="org.apache.ant.source" version="1.9.6.v201510161327"/>
- <unit id="org.apache.commons.codec" version="1.9.0.v20170208-1614"/>
- <unit id="org.apache.commons.codec.source" version="1.9.0.v20170208-1614"/>
+ <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
+ <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.15.0.v20180119-1613"/>
<unit id="org.apache.commons.compress.source" version="1.15.0.v20180119-1613"/>
- <unit id="org.apache.commons.logging" version="1.1.1.v201101211721"/>
- <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.commons.logging" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.5.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore" version="4.4.9.v20180409-1525"/>
+ <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.9.v20180409-1525"/>
<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"/>
@@ -64,12 +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/R20180606145124/repository"/>
- </location>
- <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <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"/>
- <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20170919201930/repository/"/>
+ <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20180730183850/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.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd
index efcba7c2c2..9c2d3f9270 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,7 +1,7 @@
target "jgit-4.8" with source configurePhase
-include "projects/jetty-9.4.8.tpd"
-include "orbit/R20180606145124-Photon.tpd"
+include "projects/jetty-9.4.11.tpd"
+include "orbit/S20180730183850-2018-09.tpd"
location "http://download.eclipse.org/releases/oxygen/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20180606145124-Photon.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20180730183850-2018-09.tpd
index 808b9d6944..0f9cc610ea 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20180606145124-Photon.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20180730183850-2018-09.tpd
@@ -1,17 +1,19 @@
-target "R20180606145124-Photon" with source configurePhase
+target "S20180730183850-2018-09" with source configurePhase
// see http://download.eclipse.org/tools/orbit/downloads/
-location "http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository" {
+location "http://download.eclipse.org/tools/orbit/downloads/drops/S20180730183850/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]
- org.apache.commons.codec.source [1.9.0.v20170208-1614,1.9.0.v20170208-1614]
+ org.apache.commons.codec [1.10.0.v20180409-1845,1.10.0.v20180409-1845]
+ org.apache.commons.codec.source [1.10.0.v20180409-1845,1.10.0.v20180409-1845]
org.apache.commons.compress [1.15.0.v20180119-1613,1.15.0.v20180119-1613]
org.apache.commons.compress.source [1.15.0.v20180119-1613,1.15.0.v20180119-1613s]
- org.apache.commons.logging [1.1.1.v201101211721,1.1.1.v201101211721]
- 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.commons.logging [1.2.0.v20180409-1502,1.2.0.v20180409-1502]
+ org.apache.commons.logging.source [1.2.0.v20180409-1502,1.2.0.v20180409-1502]
+ org.apache.httpcomponents.httpclient [4.5.5.v20180409-1525,4.5.5.v20180409-1525]
+ org.apache.httpcomponents.httpclient.source [4.5.5.v20180409-1525,4.5.5.v20180409-1525]
+ org.apache.httpcomponents.httpcore [4.4.9.v20180409-1525,4.4.9.v20180409-1525]
+ org.apache.httpcomponents.httpcore.source [4.4.9.v20180409-1525,4.4.9.v20180409-1525]
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]
@@ -44,9 +46,3 @@ location "http://download.eclipse.org/tools/orbit/downloads/drops/R2018060614512
com.jcraft.jzlib [1.1.1.v201205102305,1.1.1.v201205102305]
com.jcraft.jzlib.source [1.1.1.v201205102305,1.1.1.v201205102305]
}
-
-location "http://download.eclipse.org/tools/orbit/downloads/drops/R20170919201930/repository/" {
- // platform uses this outdated version of httpclient in Photon
- 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]
-} \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.11.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.11.tpd
new file mode 100644
index 0000000000..d2fd9017b3
--- /dev/null
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.11.tpd
@@ -0,0 +1,20 @@
+target "jetty-9.4.11" with source configurePhase
+
+location jetty-9.4.11 "http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.11.v20180605" {
+ org.eclipse.jetty.client [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.client.source [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.continuation [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.continuation.source [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.http [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.http.source [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.io [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.io.source [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.security [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.security.source [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.server [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.server.source [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.servlet [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.servlet.source [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.util [9.4.11.v20180605,9.4.11.v20180605]
+ org.eclipse.jetty.util.source [9.4.11.v20180605,9.4.11.v20180605]
+}
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.8.tpd
deleted file mode 100644
index e37a062115..0000000000
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.8.tpd
+++ /dev/null
@@ -1,20 +0,0 @@
-target "jetty-9.4.8" with source configurePhase
-
-location jetty-9.4.8 "http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.8.v20171121" {
- org.eclipse.jetty.client [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.client.source [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.continuation [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.continuation.source [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.http [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.http.source [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.io [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.io.source [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.security [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.security.source [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.server [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.server.source [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.servlet [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.servlet.source [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.util [9.4.8.v20171121,9.4.8.v20171121]
- org.eclipse.jetty.util.source [9.4.8.v20171121,9.4.8.v20171121]
-}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
index df31ab0869..1eca587bfb 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
@@ -268,7 +268,8 @@ public class RepoCommandTest extends RepositoryTestCase {
.getCachedBytes(Integer.MAX_VALUE);
Config base = new Config();
BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "base", "url");
+ String subUrl = cfg.getString("submodule", "platform/base",
+ "url");
assertEquals(subUrl, "../base");
}
}
@@ -301,7 +302,8 @@ public class RepoCommandTest extends RepositoryTestCase {
.getCachedBytes(Integer.MAX_VALUE);
Config base = new Config();
BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "base", "url");
+ String subUrl = cfg.getString("submodule", "platform/base",
+ "url");
assertEquals(subUrl, "https://host.com/platform/base");
}
}
@@ -387,8 +389,8 @@ public class RepoCommandTest extends RepositoryTestCase {
.getCachedBytes(Integer.MAX_VALUE);
Config base = new Config();
BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "src",
- "url");
+ String subUrl = cfg.getString("submodule",
+ "chromium/src", "url");
assertEquals(
"https://chromium.googlesource.com/chromium/src",
subUrl);
@@ -443,8 +445,8 @@ public class RepoCommandTest extends RepositoryTestCase {
.getCachedBytes(Integer.MAX_VALUE);
Config base = new Config();
BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "src",
- "url");
+ String subUrl = cfg.getString("submodule",
+ "chromium/src", "url");
assertEquals("../chromium/src", subUrl);
}
fetchSlash = !fetchSlash;
@@ -613,7 +615,7 @@ public class RepoCommandTest extends RepositoryTestCase {
String content = reader.readLine();
assertEquals(
"The first line of .gitmodules file should be as expected",
- "[submodule \"foo\"]", content);
+ "[submodule \"" + defaultUri + "\"]", content);
}
// The gitlink should be the same as remote head sha1
String gitlink = localDb.resolve(Constants.HEAD + ":foo").name();
@@ -801,9 +803,9 @@ public class RepoCommandTest extends RepositoryTestCase {
.append("<manifest>")
.append("<remote name=\"remote1\" fetch=\".\" />")
.append("<default revision=\"master\" remote=\"remote1\" />")
- .append("<project path=\"bar\" name=\"").append(defaultUri)
- .append("\" revision=\"").append(BRANCH).append("\" >")
- .append("<copyfile src=\"hello.txt\" dest=\"Hello.txt\" />")
+ .append("<project path=\"bar\" name=\"").append(notDefaultUri)
+ .append("\" >")
+ .append("<copyfile src=\"world.txt\" dest=\"World.txt\" />")
.append("</project>").append("</manifest>");
JGitTestUtil.writeTrashFile(tempDb, "new.xml", xmlContent.toString());
command = new RepoCommand(remoteDb);
@@ -819,8 +821,8 @@ public class RepoCommandTest extends RepositoryTestCase {
File hello = new File(localDb.getWorkTree(), "Hello");
assertFalse("The Hello file shouldn't exist", hello.exists());
// The Hello.txt file should exist
- File hellotxt = new File(localDb.getWorkTree(), "Hello.txt");
- assertTrue("The Hello.txt file should exist", hellotxt.exists());
+ File hellotxt = new File(localDb.getWorkTree(), "World.txt");
+ assertTrue("The World.txt file should exist", hellotxt.exists());
dotmodules = new File(localDb.getWorkTree(),
Constants.DOT_GIT_MODULES);
}
@@ -835,9 +837,9 @@ public class RepoCommandTest extends RepositoryTestCase {
String line = reader.readLine();
if (line == null)
break;
- if (line.contains("submodule \"foo\""))
+ if (line.contains("submodule \"" + defaultUri + "\""))
foo = true;
- if (line.contains("submodule \"bar\""))
+ if (line.contains("submodule \"" + notDefaultUri + "\""))
bar = true;
}
assertTrue("The bar submodule should exist", bar);
@@ -876,9 +878,7 @@ public class RepoCommandTest extends RepositoryTestCase {
Constants.DOT_GIT_MODULES);
}
- // The .gitmodules file should have 'submodule "foo"' and shouldn't
- // have
- // 'submodule "foo/bar"' lines.
+ // Check .gitmodules file
try (BufferedReader reader = new BufferedReader(
new FileReader(dotmodules))) {
boolean foo = false;
@@ -888,16 +888,17 @@ public class RepoCommandTest extends RepositoryTestCase {
String line = reader.readLine();
if (line == null)
break;
- if (line.contains("submodule \"foo\""))
+ if (line.contains("submodule \"" + defaultUri + "\""))
foo = true;
- if (line.contains("submodule \"foo/bar\""))
+ if (line.contains("submodule \"" + groupBUri + "\""))
foobar = true;
- if (line.contains("submodule \"a\""))
+ if (line.contains("submodule \"" + groupAUri + "\""))
a = true;
}
- assertTrue("The foo submodule should exist", foo);
- assertFalse("The foo/bar submodule shouldn't exist", foobar);
- assertTrue("The a submodule should exist", a);
+ assertTrue("The " + defaultUri + " submodule should exist", foo);
+ assertFalse("The " + groupBUri + " submodule shouldn't exist",
+ foobar);
+ assertTrue("The " + groupAUri + " submodule should exist", a);
}
}
@@ -1033,11 +1034,11 @@ public class RepoCommandTest extends RepositoryTestCase {
assertEquals(
"Recording remote branches should work for short branch descriptions",
"master",
- c.getString("submodule", "with-branch", "branch"));
+ c.getString("submodule", notDefaultUri, "branch"));
assertEquals(
"Recording remote branches should work for full ref specs",
"refs/heads/master",
- c.getString("submodule", "with-long-branch", "branch"));
+ c.getString("submodule", defaultUri, "branch"));
}
}
@@ -1095,7 +1096,7 @@ public class RepoCommandTest extends RepositoryTestCase {
.append("<project path=\"shallow-please\" ").append("name=\"")
.append(defaultUri).append("\" ").append("clone-depth=\"1\" />")
.append("<project path=\"non-shallow\" ").append("name=\"")
- .append(defaultUri).append("\" />").append("</manifest>");
+ .append(notDefaultUri).append("\" />").append("</manifest>");
JGitTestUtil.writeTrashFile(tempDb, "manifest.xml",
xmlContent.toString());
@@ -1115,9 +1116,9 @@ public class RepoCommandTest extends RepositoryTestCase {
FileBasedConfig c = new FileBasedConfig(gitmodules, FS.DETECTED);
c.load();
assertEquals("Recording shallow configuration should work", "true",
- c.getString("submodule", "shallow-please", "shallow"));
+ c.getString("submodule", defaultUri, "shallow"));
assertNull("Recording non shallow configuration should work",
- c.getString("submodule", "non-shallow", "shallow"));
+ c.getString("submodule", notDefaultUri, "shallow"));
}
}
@@ -1176,6 +1177,43 @@ public class RepoCommandTest extends RepositoryTestCase {
}
}
+ @Test
+ public void testTwoPathUseTheSameName() throws Exception {
+ Repository remoteDb = createBareRepository();
+ Repository tempDb = createWorkRepository();
+
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"remote1\" fetch=\".\" />")
+ .append("<default revision=\"master\" remote=\"remote1\" />")
+ .append("<project path=\"path1\" ").append("name=\"")
+ .append(defaultUri).append("\" />")
+ .append("<project path=\"path2\" ").append("name=\"")
+ .append(defaultUri).append("\" />").append("</manifest>");
+ JGitTestUtil.writeTrashFile(tempDb, "manifest.xml",
+ xmlContent.toString());
+
+ RepoCommand command = new RepoCommand(remoteDb);
+ command.setPath(
+ tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml")
+ .setURI(rootUri).setRecommendShallow(true).call();
+ File directory = createTempDirectory("testBareRepo");
+ try (Repository localDb = Git.cloneRepository().setDirectory(directory)
+ .setURI(remoteDb.getDirectory().toURI().toString()).call()
+ .getRepository();) {
+ File gitmodules = new File(localDb.getWorkTree(), ".gitmodules");
+ assertTrue("The .gitmodules file should exist",
+ gitmodules.exists());
+ FileBasedConfig c = new FileBasedConfig(gitmodules, FS.DETECTED);
+ c.load();
+ assertEquals("A module should exist for path1", "path1",
+ c.getString("submodule", defaultUri + "/path1", "path"));
+ assertEquals("A module should exist for path2", "path2",
+ c.getString("submodule", defaultUri + "/path2", "path"));
+ }
+ }
+
private void resolveRelativeUris() {
// Find the longest common prefix ends with "/" as rootUri.
defaultUri = defaultDb.getDirectory().toURI().toString();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcDeleteEmptyRefsFoldersTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcDeleteEmptyRefsFoldersTest.java
index 76e1534c59..3caae72fc6 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcDeleteEmptyRefsFoldersTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcDeleteEmptyRefsFoldersTest.java
@@ -46,6 +46,7 @@ package org.eclipse.jgit.internal.storage.file;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -56,8 +57,8 @@ import org.junit.Before;
import org.junit.Test;
public class GcDeleteEmptyRefsFoldersTest extends GcTestCase {
- private static final String REF_FOLDER_01 = "01";
- private static final String REF_FOLDER_02 = "02";
+ private static final String REF_FOLDER_01 = "A/B/01";
+ private static final String REF_FOLDER_02 = "C/D/02";
private Path refsDir;
private Path heads;
@@ -74,23 +75,36 @@ public class GcDeleteEmptyRefsFoldersTest extends GcTestCase {
@Test
public void emptyRefFoldersAreDeleted() throws Exception {
FileTime fileTime = FileTime.from(Instant.now().minusSeconds(31));
- Path refDir01 = Files.createDirectory(heads.resolve(REF_FOLDER_01));
- Path refDir02 = Files.createDirectory(heads.resolve(REF_FOLDER_02));
- Files.setLastModifiedTime(refDir01, fileTime);
- Files.setLastModifiedTime(refDir02, fileTime);
+ Path refDir01 = Files.createDirectories(heads.resolve(REF_FOLDER_01));
+ Path refDir02 = Files.createDirectories(heads.resolve(REF_FOLDER_02));
+ setLastModifiedTime(fileTime, heads, REF_FOLDER_01);
+ setLastModifiedTime(fileTime, heads, REF_FOLDER_02);
assertTrue(refDir01.toFile().exists());
assertTrue(refDir02.toFile().exists());
gc.gc();
assertFalse(refDir01.toFile().exists());
+ assertFalse(refDir01.getParent().toFile().exists());
+ assertFalse(refDir01.getParent().getParent().toFile().exists());
assertFalse(refDir02.toFile().exists());
+ assertFalse(refDir02.getParent().toFile().exists());
+ assertFalse(refDir02.getParent().getParent().toFile().exists());
+ }
+
+ private void setLastModifiedTime(FileTime fileTime, Path path, String folder) throws IOException {
+ long numParents = folder.chars().filter(c -> c == '/').count();
+ Path folderPath = path.resolve(folder);
+ for(int folderLevel = 0; folderLevel <= numParents; folderLevel ++ ) {
+ Files.setLastModifiedTime(folderPath, fileTime);
+ folderPath = folderPath.getParent();
+ }
}
@Test
public void emptyRefFoldersAreKeptIfTheyAreTooRecent()
throws Exception {
- Path refDir01 = Files.createDirectory(heads.resolve(REF_FOLDER_01));
- Path refDir02 = Files.createDirectory(heads.resolve(REF_FOLDER_02));
+ Path refDir01 = Files.createDirectories(heads.resolve(REF_FOLDER_01));
+ Path refDir02 = Files.createDirectories(heads.resolve(REF_FOLDER_02));
assertTrue(refDir01.toFile().exists());
assertTrue(refDir02.toFile().exists());
gc.gc();
@@ -101,8 +115,8 @@ public class GcDeleteEmptyRefsFoldersTest extends GcTestCase {
@Test
public void nonEmptyRefsFoldersAreKept() throws Exception {
- Path refDir01 = Files.createDirectory(heads.resolve(REF_FOLDER_01));
- Path refDir02 = Files.createDirectory(heads.resolve(REF_FOLDER_02));
+ Path refDir01 = Files.createDirectories(heads.resolve(REF_FOLDER_01));
+ Path refDir02 = Files.createDirectories(heads.resolve(REF_FOLDER_02));
Path ref01 = Files.createFile(refDir01.resolve("ref01"));
Path ref02 = Files.createFile(refDir01.resolve("ref02"));
assertTrue(refDir01.toFile().exists());
@@ -115,4 +129,4 @@ public class GcDeleteEmptyRefsFoldersTest extends GcTestCase {
assertTrue(ref01.toFile().exists());
assertTrue(ref02.toFile().exists());
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java
index 58093a3729..da4513d1f7 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java
@@ -60,6 +60,7 @@ import java.util.Map;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.MergeResult;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
+import org.eclipse.jgit.api.RebaseResult;
import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.JGitInternalException;
@@ -428,6 +429,44 @@ public class MergerTest extends RepositoryTestCase {
indexState(CONTENT));
}
+ @Theory
+ public void rebaseWithCrlfAutoCrlfTrue(MergeStrategy strategy)
+ throws IOException, GitAPIException {
+ Git git = Git.wrap(db);
+ db.getConfig().setString("core", null, "autocrlf", "true");
+ db.getConfig().save();
+ writeTrashFile("crlf.txt", "line 1\r\nline 2\r\nline 3\r\n");
+ git.add().addFilepattern("crlf.txt").call();
+ RevCommit first = git.commit().setMessage("base").call();
+
+ git.checkout().setCreateBranch(true).setStartPoint(first)
+ .setName("brancha").call();
+
+ File testFile = writeTrashFile("crlf.txt",
+ "line 1\r\nmodified line\r\nline 3\r\n");
+ git.add().addFilepattern("crlf.txt").call();
+ git.commit().setMessage("on brancha").call();
+
+ git.checkout().setName("master").call();
+ File otherFile = writeTrashFile("otherfile.txt", "a line\r\n");
+ git.add().addFilepattern("otherfile.txt").call();
+ git.commit().setMessage("on master").call();
+
+ git.checkout().setName("brancha").call();
+ checkFile(testFile, "line 1\r\nmodified line\r\nline 3\r\n");
+ assertFalse(otherFile.exists());
+
+ RebaseResult rebaseResult = git.rebase().setStrategy(strategy)
+ .setUpstream(db.resolve("master")).call();
+ assertEquals(RebaseResult.Status.OK, rebaseResult.getStatus());
+ checkFile(testFile, "line 1\r\nmodified line\r\nline 3\r\n");
+ checkFile(otherFile, "a line\r\n");
+ assertEquals(
+ "[crlf.txt, mode:100644, content:line 1\nmodified line\nline 3\n]"
+ + "[otherfile.txt, mode:100644, content:a line\n]",
+ indexState(CONTENT));
+ }
+
/**
* Merging two equal subtrees when the index does not contain any file in
* that subtree should lead to a merged state.
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
index df4b96398f..815ce9b350 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
@@ -136,10 +136,12 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
generator.next();
//want to create a commit inside the repo...
- Repository submoduleLocalRepo = generator.getRepository();
- JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt", "new data");
- Git.wrap(submoduleLocalRepo).commit().setAll(true).setMessage("local commit").call();
-
+ try (Repository submoduleLocalRepo = generator.getRepository()) {
+ JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt",
+ "new data");
+ Git.wrap(submoduleLocalRepo).commit().setAll(true)
+ .setMessage("local commit").call();
+ }
SubmoduleDeinitResult result = runDeinit(new SubmoduleDeinitCommand(db).addPath("sub"));
assertEquals(path, result.getPath());
assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.DIRTY, result.getStatus());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java
index b77042220f..9cc6cfd393 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java
@@ -259,6 +259,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas
try (TransportLocal t = newTransportLocalWithStrictValidation()) {
t.setPushThin(true);
r = t.push(PM, Collections.singleton(u));
+ dst.close();
}
assertNotNull("have result", r);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
index 2a3e1ca56d..79d3d87e2d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
@@ -1,20 +1,24 @@
package org.eclipse.jgit.transport;
+import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.theInstance;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.internal.storage.dfs.DfsGarbageCollector;
@@ -29,8 +33,8 @@ import org.eclipse.jgit.lib.Sets;
import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevTag;
+import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.transport.UploadPack.RequestPolicy;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
@@ -419,7 +423,8 @@ public class UploadPackTest {
* and returns UploadPack's output stream.
*/
private ByteArrayInputStream uploadPackV2Setup(RequestPolicy requestPolicy,
- RefFilter refFilter, String... inputLines) throws Exception {
+ RefFilter refFilter, ProtocolV2Hook hook, String... inputLines)
+ throws Exception {
ByteArrayOutputStream send = new ByteArrayOutputStream();
PacketLineOut pckOut = new PacketLineOut(send);
@@ -440,6 +445,9 @@ public class UploadPackTest {
if (refFilter != null)
up.setRefFilter(refFilter);
up.setExtraParameters(Sets.of("version=2"));
+ if (hook != null) {
+ up.setProtocolV2Hook(hook);
+ }
ByteArrayOutputStream recv = new ByteArrayOutputStream();
up.upload(new ByteArrayInputStream(send.toByteArray()), recv, null);
@@ -453,9 +461,10 @@ public class UploadPackTest {
* advertisement by the server.
*/
private ByteArrayInputStream uploadPackV2(RequestPolicy requestPolicy,
- RefFilter refFilter, String... inputLines) throws Exception {
+ RefFilter refFilter, ProtocolV2Hook hook, String... inputLines)
+ throws Exception {
ByteArrayInputStream recvStream =
- uploadPackV2Setup(requestPolicy, refFilter, inputLines);
+ uploadPackV2Setup(requestPolicy, refFilter, hook, inputLines);
PacketLineIn pckIn = new PacketLineIn(recvStream);
// drain capabilities
@@ -466,15 +475,33 @@ public class UploadPackTest {
}
private ByteArrayInputStream uploadPackV2(String... inputLines) throws Exception {
- return uploadPackV2(null, null, inputLines);
+ return uploadPackV2(null, null, null, inputLines);
+ }
+
+ private static class TestV2Hook implements ProtocolV2Hook {
+ private CapabilitiesV2Request capabilitiesRequest;
+
+ private LsRefsV2Request lsRefsRequest;
+
+ @Override
+ public void onCapabilities(CapabilitiesV2Request req) {
+ capabilitiesRequest = req;
+ }
+
+ @Override
+ public void onLsRefs(LsRefsV2Request req) {
+ lsRefsRequest = req;
+ }
}
@Test
public void testV2Capabilities() throws Exception {
+ TestV2Hook hook = new TestV2Hook();
ByteArrayInputStream recvStream =
- uploadPackV2Setup(null, null, PacketLineIn.END);
+ uploadPackV2Setup(null, null, hook, PacketLineIn.END);
PacketLineIn pckIn = new PacketLineIn(recvStream);
+ assertThat(hook.capabilitiesRequest, notNullValue());
assertThat(pckIn.readString(), is("version 2"));
assertThat(
Arrays.asList(pckIn.readString(), pckIn.readString()),
@@ -492,7 +519,7 @@ public class UploadPackTest {
public void testV2CapabilitiesAllowFilter() throws Exception {
server.getConfig().setBoolean("uploadpack", null, "allowfilter", true);
ByteArrayInputStream recvStream =
- uploadPackV2Setup(null, null, PacketLineIn.END);
+ uploadPackV2Setup(null, null, null, PacketLineIn.END);
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is("version 2"));
@@ -505,6 +532,51 @@ public class UploadPackTest {
}
@Test
+ public void testV2CapabilitiesRefInWant() throws Exception {
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
+ ByteArrayInputStream recvStream =
+ uploadPackV2Setup(null, null, null, PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+
+ assertThat(pckIn.readString(), is("version 2"));
+ assertThat(
+ Arrays.asList(pckIn.readString(), pckIn.readString()),
+ // TODO(jonathantanmy) This check overspecifies the
+ // order of the capabilities of "fetch".
+ hasItems("ls-refs", "fetch=ref-in-want shallow"));
+ assertTrue(pckIn.readString() == PacketLineIn.END);
+ }
+
+ @Test
+ public void testV2CapabilitiesRefInWantNotAdvertisedIfUnallowed() throws Exception {
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", false);
+ ByteArrayInputStream recvStream =
+ uploadPackV2Setup(null, null, null, PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+
+ assertThat(pckIn.readString(), is("version 2"));
+ assertThat(
+ Arrays.asList(pckIn.readString(), pckIn.readString()),
+ hasItems("ls-refs", "fetch=shallow"));
+ assertTrue(pckIn.readString() == PacketLineIn.END);
+ }
+
+ @Test
+ public void testV2CapabilitiesRefInWantNotAdvertisedIfAdvertisingForbidden() throws Exception {
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
+ server.getConfig().setBoolean("uploadpack", null, "advertiserefinwant", false);
+ ByteArrayInputStream recvStream =
+ uploadPackV2Setup(null, null, null, PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+
+ assertThat(pckIn.readString(), is("version 2"));
+ assertThat(
+ Arrays.asList(pckIn.readString(), pckIn.readString()),
+ hasItems("ls-refs", "fetch=shallow"));
+ assertTrue(pckIn.readString() == PacketLineIn.END);
+ }
+
+ @Test
@SuppressWarnings("boxing")
public void testV2EmptyRequest() throws Exception {
ByteArrayInputStream recvStream = uploadPackV2(PacketLineIn.END);
@@ -521,9 +593,12 @@ public class UploadPackTest {
RevTag tag = remote.tag("tag", tip);
remote.update("refs/tags/tag", tag);
- ByteArrayInputStream recvStream = uploadPackV2("command=ls-refs\n", PacketLineIn.END);
+ TestV2Hook hook = new TestV2Hook();
+ ByteArrayInputStream recvStream = uploadPackV2(null, null, hook,
+ "command=ls-refs\n", PacketLineIn.END);
PacketLineIn pckIn = new PacketLineIn(recvStream);
+ assertThat(hook.lsRefsRequest, notNullValue());
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " HEAD"));
assertThat(pckIn.readString(), is(tip.toObjectId().getName() + " refs/heads/master"));
assertThat(pckIn.readString(), is(tag.toObjectId().getName() + " refs/tags/tag"));
@@ -658,6 +733,10 @@ public class UploadPackTest {
new StringWriter(), NullOutputStream.INSTANCE);
PackParser pp = client.newObjectInserter().newPackParser(sb);
pp.parse(NullProgressMonitor.INSTANCE);
+
+ // Ensure that there is nothing left in the stream.
+ assertThat(recvStream.read(), is(-1));
+
return pp.getReceivedPackStatistics();
}
@@ -671,6 +750,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.ADVERTISED,
null,
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + advertized.name() + "\n",
@@ -683,6 +763,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.ADVERTISED,
null,
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + unadvertized.name() + "\n",
@@ -700,6 +781,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.REACHABLE_COMMIT,
null,
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + reachable.name() + "\n",
@@ -712,6 +794,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.REACHABLE_COMMIT,
null,
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + unreachable.name() + "\n",
@@ -728,6 +811,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.TIP,
new RejectAllRefFilter(),
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + tip.name() + "\n",
@@ -740,6 +824,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.TIP,
new RejectAllRefFilter(),
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + parentOfTip.name() + "\n",
@@ -757,6 +842,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.REACHABLE_COMMIT_TIP,
new RejectAllRefFilter(),
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + parentOfTip.name() + "\n",
@@ -769,6 +855,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.REACHABLE_COMMIT_TIP,
new RejectAllRefFilter(),
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + unreachable.name() + "\n",
@@ -783,6 +870,7 @@ public class UploadPackTest {
uploadPackV2(
RequestPolicy.ANY,
null,
+ null,
"command=fetch\n",
PacketLineIn.DELIM,
"want " + unreachable.name() + "\n",
@@ -1157,6 +1245,178 @@ public class UploadPackTest {
PacketLineIn.END);
}
+ @Test
+ public void testV2FetchWantRefIfNotAllowed() throws Exception {
+ RevCommit one = remote.commit().message("1").create();
+ remote.update("one", one);
+
+ try {
+ uploadPackV2(
+ "command=fetch\n",
+ PacketLineIn.DELIM,
+ "want-ref refs/heads/one\n",
+ "done\n",
+ PacketLineIn.END);
+ } catch (PackProtocolException e) {
+ assertThat(
+ e.getMessage(),
+ containsString("unexpected want-ref refs/heads/one"));
+ return;
+ }
+ fail("expected PackProtocolException");
+ }
+
+ @Test
+ public void testV2FetchWantRef() throws Exception {
+ RevCommit one = remote.commit().message("1").create();
+ RevCommit two = remote.commit().message("2").create();
+ RevCommit three = remote.commit().message("3").create();
+ remote.update("one", one);
+ remote.update("two", two);
+ remote.update("three", three);
+
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
+
+ ByteArrayInputStream recvStream = uploadPackV2(
+ "command=fetch\n",
+ PacketLineIn.DELIM,
+ "want-ref refs/heads/one\n",
+ "want-ref refs/heads/two\n",
+ "done\n",
+ PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+ assertThat(pckIn.readString(), is("wanted-refs"));
+ assertThat(
+ Arrays.asList(pckIn.readString(), pckIn.readString()),
+ hasItems(
+ one.toObjectId().getName() + " refs/heads/one",
+ two.toObjectId().getName() + " refs/heads/two"));
+ assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
+ assertThat(pckIn.readString(), is("packfile"));
+ parsePack(recvStream);
+
+ assertTrue(client.hasObject(one.toObjectId()));
+ assertTrue(client.hasObject(two.toObjectId()));
+ assertFalse(client.hasObject(three.toObjectId()));
+ }
+
+ @Test
+ public void testV2FetchBadWantRef() throws Exception {
+ RevCommit one = remote.commit().message("1").create();
+ remote.update("one", one);
+
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
+
+ try {
+ uploadPackV2(
+ "command=fetch\n",
+ PacketLineIn.DELIM,
+ "want-ref refs/heads/one\n",
+ "want-ref refs/heads/nonExistentRef\n",
+ "done\n",
+ PacketLineIn.END);
+ } catch (PackProtocolException e) {
+ assertThat(
+ e.getMessage(),
+ containsString("Invalid ref name: refs/heads/nonExistentRef"));
+ return;
+ }
+ fail("expected PackProtocolException");
+ }
+
+ @Test
+ public void testV2FetchMixedWantRef() throws Exception {
+ RevCommit one = remote.commit().message("1").create();
+ RevCommit two = remote.commit().message("2").create();
+ RevCommit three = remote.commit().message("3").create();
+ remote.update("one", one);
+ remote.update("two", two);
+ remote.update("three", three);
+
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
+
+ ByteArrayInputStream recvStream = uploadPackV2(
+ "command=fetch\n",
+ PacketLineIn.DELIM,
+ "want-ref refs/heads/one\n",
+ "want " + two.toObjectId().getName() + "\n",
+ "done\n",
+ PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+ assertThat(pckIn.readString(), is("wanted-refs"));
+ assertThat(
+ pckIn.readString(),
+ is(one.toObjectId().getName() + " refs/heads/one"));
+ assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
+ assertThat(pckIn.readString(), is("packfile"));
+ parsePack(recvStream);
+
+ assertTrue(client.hasObject(one.toObjectId()));
+ assertTrue(client.hasObject(two.toObjectId()));
+ assertFalse(client.hasObject(three.toObjectId()));
+ }
+
+ @Test
+ public void testV2FetchWantRefWeAlreadyHave() throws Exception {
+ RevCommit one = remote.commit().message("1").create();
+ remote.update("one", one);
+
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
+
+ ByteArrayInputStream recvStream = uploadPackV2(
+ "command=fetch\n",
+ PacketLineIn.DELIM,
+ "want-ref refs/heads/one\n",
+ "have " + one.toObjectId().getName(),
+ "done\n",
+ PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+
+ // The client still needs to know the hash of the object that
+ // refs/heads/one points to, even though it already has the
+ // object ...
+ assertThat(pckIn.readString(), is("wanted-refs"));
+ assertThat(
+ pckIn.readString(),
+ is(one.toObjectId().getName() + " refs/heads/one"));
+ assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
+
+ // ... but the client does not need the object itself.
+ assertThat(pckIn.readString(), is("packfile"));
+ parsePack(recvStream);
+ assertFalse(client.hasObject(one.toObjectId()));
+ }
+
+ @Test
+ public void testV2FetchWantRefAndDeepen() throws Exception {
+ RevCommit parent = remote.commit().message("parent").create();
+ RevCommit child = remote.commit().message("x").parent(parent).create();
+ remote.update("branch1", child);
+
+ server.getConfig().setBoolean("uploadpack", null, "allowrefinwant", true);
+
+ ByteArrayInputStream recvStream = uploadPackV2(
+ "command=fetch\n",
+ PacketLineIn.DELIM,
+ "want-ref refs/heads/branch1\n",
+ "deepen 1\n",
+ "done\n",
+ PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+
+ // shallow-info appears first, then wanted-refs.
+ assertThat(pckIn.readString(), is("shallow-info"));
+ assertThat(pckIn.readString(), is("shallow " + child.toObjectId().getName()));
+ assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
+ assertThat(pckIn.readString(), is("wanted-refs"));
+ assertThat(pckIn.readString(), is(child.toObjectId().getName() + " refs/heads/branch1"));
+ assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
+ assertThat(pckIn.readString(), is("packfile"));
+ parsePack(recvStream);
+ assertTrue(client.hasObject(child.toObjectId()));
+ assertFalse(client.hasObject(parent.toObjectId()));
+ }
+
private static class RejectAllRefFilter implements RefFilter {
@Override
public Map<String, Ref> filter(Map<String, Ref> refs) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
index 0e009b9540..e031678339 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
@@ -331,7 +331,7 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
DirCacheEntry dce = db.readDirCache().getEntry("symlink");
dce.setFileMode(FileMode.SYMLINK);
try (ObjectReader objectReader = db.newObjectReader()) {
- DirCacheCheckout.checkoutEntry(db, dce, objectReader);
+ DirCacheCheckout.checkoutEntry(db, dce, objectReader, false, null);
FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(),
db.getConfig().get(WorkingTreeOptions.KEY));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FilterCommandsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FilterCommandsTest.java
index 0d31811257..8dfdd0fc7c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FilterCommandsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FilterCommandsTest.java
@@ -85,6 +85,8 @@ public class FilterCommandsTest extends RepositoryTestCase {
public int run() throws IOException {
int b = in.read();
if (b == -1) {
+ in.close();
+ out.close();
return b;
}
out.write(prefix);
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index e51bf20c22..b7b49bc658 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jgit" version="2">
+ <resource path="src/org/eclipse/jgit/lib/ConfigConstants.java" type="org.eclipse.jgit.lib.ConfigConstants">
+ <filter id="337768515">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.lib.ConfigConstants"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/jgit/lib/ObjectIdSerializer.java" type="org.eclipse.jgit.lib.ObjectIdSerializer">
<filter id="1141899266">
<message_arguments>
@@ -16,4 +23,11 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/jgit/transport/GitProtocolConstants.java" type="org.eclipse.jgit.transport.GitProtocolConstants">
+ <filter id="337768515">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.transport.GitProtocolConstants"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml
index 9dc588db24..0110ff9dd7 100644
--- a/org.eclipse.jgit/pom.xml
+++ b/org.eclipse.jgit/pom.xml
@@ -84,10 +84,6 @@
<artifactId>JavaEWAH</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 34c90f9773..2150d5ce3e 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -49,6 +49,7 @@ branchNameInvalid=Branch name {0} is not allowed
buildingBitmaps=Building bitmaps
cachedPacksPreventsIndexCreation=Using cached packs prevents index creation
cachedPacksPreventsListingObjects=Using cached packs prevents listing objects
+cannotAccessLastModifiedForSafeDeletion=Unable to access lastModifiedTime of file {0}, skip deletion since we cannot safely avoid race condition
cannotBeCombined=Cannot be combined.
cannotBeRecursiveWhenTreesAreIncluded=TreeWalk shouldn't be recursive when tree objects are included.
cannotChangeActionOnComment=Cannot change action on comment line in git-rebase-todo file, old action: {0}, new action: {1}.
@@ -578,6 +579,7 @@ remoteNameCantBeNull=Remote name can't be null.
renameBranchFailedBecauseTag=Can not rename as Ref {0} is a tag
renameBranchFailedUnknownReason=Rename failed with unknown reason
renameBranchUnexpectedResult=Unexpected rename result {0}
+renameCancelled=Rename detection was cancelled
renameFileFailed=Could not rename file {0} to {1}
renamesAlreadyFound=Renames have already been found.
renamesBreakingModifies=Breaking apart modified file pairs
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
index 98c16b8931..1783c4193e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -275,9 +275,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
throw new JGitInternalException(ioe.getMessage(), ioe);
}
case PROCESS_STEPS:
- // fall through
case SKIP:
- // fall through
case CONTINUE:
String upstreamCommitId = rebaseState.readFile(ONTO);
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java
index 569a8e3596..5a0528b0f5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleDeinitCommand.java
@@ -227,11 +227,11 @@ public class SubmoduleDeinitCommand
return SubmoduleDeinitStatus.DIRTY;
}
- Repository submoduleRepo = w.getRepository();
-
- Status status = Git.wrap(submoduleRepo).status().call();
- return status.isClean() ? SubmoduleDeinitStatus.SUCCESS
- : SubmoduleDeinitStatus.DIRTY;
+ try (Repository submoduleRepo = w.getRepository()) {
+ Status status = Git.wrap(submoduleRepo).status().call();
+ return status.isClean() ? SubmoduleDeinitStatus.SUCCESS
+ : SubmoduleDeinitStatus.DIRTY;
+ }
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
index 7aaa50030f..e7ad0bc40d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
@@ -67,6 +67,7 @@ import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.errors.BinaryBlobException;
+import org.eclipse.jgit.errors.CancelledException;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -577,7 +578,14 @@ public class DiffFormatter implements AutoCloseable {
throws IOException {
renameDetector.reset();
renameDetector.addAll(files);
- return renameDetector.compute(reader, progressMonitor);
+ try {
+ return renameDetector.compute(reader, progressMonitor);
+ } catch (CancelledException e) {
+ // TODO: consider propagating once bug 536323 is tackled
+ // (making DiffEntry.scan() and DiffFormatter.scan() and
+ // format() cancellable).
+ return Collections.emptyList();
+ }
}
private boolean isAdd(List<DiffEntry> files) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
index 7bb217d04d..772fbb5ffe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
@@ -57,6 +57,7 @@ import java.util.List;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.diff.SimilarityIndex.TableFullException;
+import org.eclipse.jgit.errors.CancelledException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.FileMode;
@@ -332,8 +333,13 @@ public class RenameDetector {
* representing all files that have been changed.
* @throws java.io.IOException
* file contents cannot be read from the repository.
+ * @throws CancelledException
+ * if rename detection was cancelled
*/
- public List<DiffEntry> compute(ProgressMonitor pm) throws IOException {
+ // TODO(ms): use org.eclipse.jgit.api.errors.CanceledException in next major
+ // version
+ public List<DiffEntry> compute(ProgressMonitor pm)
+ throws IOException, CancelledException {
if (!done) {
try {
return compute(objectReader, pm);
@@ -355,9 +361,13 @@ public class RenameDetector {
* representing all files that have been changed.
* @throws java.io.IOException
* file contents cannot be read from the repository.
+ * @throws CancelledException
+ * if rename detection was cancelled
*/
+ // TODO(ms): use org.eclipse.jgit.api.errors.CanceledException in next major
+ // version
public List<DiffEntry> compute(ObjectReader reader, ProgressMonitor pm)
- throws IOException {
+ throws IOException, CancelledException {
final ContentSource cs = ContentSource.create(reader);
return compute(new ContentSource.Pair(cs, cs), pm);
}
@@ -373,9 +383,13 @@ public class RenameDetector {
* representing all files that have been changed.
* @throws java.io.IOException
* file contents cannot be read from the repository.
+ * @throws CancelledException
+ * if rename detection was cancelled
*/
+ // TODO(ms): use org.eclipse.jgit.api.errors.CanceledException in next major
+ // version
public List<DiffEntry> compute(ContentSource.Pair reader, ProgressMonitor pm)
- throws IOException {
+ throws IOException, CancelledException {
if (!done) {
done = true;
@@ -415,8 +429,15 @@ public class RenameDetector {
done = false;
}
+ private void advanceOrCancel(ProgressMonitor pm) throws CancelledException {
+ if (pm.isCancelled()) {
+ throw new CancelledException(JGitText.get().renameCancelled);
+ }
+ pm.update(1);
+ }
+
private void breakModifies(ContentSource.Pair reader, ProgressMonitor pm)
- throws IOException {
+ throws IOException, CancelledException {
ArrayList<DiffEntry> newEntries = new ArrayList<>(entries.size());
pm.beginTask(JGitText.get().renamesBreakingModifies, entries.size());
@@ -437,13 +458,13 @@ public class RenameDetector {
} else {
newEntries.add(e);
}
- pm.update(1);
+ advanceOrCancel(pm);
}
entries = newEntries;
}
- private void rejoinModifies(ProgressMonitor pm) {
+ private void rejoinModifies(ProgressMonitor pm) throws CancelledException {
HashMap<String, DiffEntry> nameMap = new HashMap<>();
ArrayList<DiffEntry> newAdded = new ArrayList<>(added.size());
@@ -452,7 +473,7 @@ public class RenameDetector {
for (DiffEntry src : deleted) {
nameMap.put(src.oldPath, src);
- pm.update(1);
+ advanceOrCancel(pm);
}
for (DiffEntry dst : added) {
@@ -468,7 +489,7 @@ public class RenameDetector {
} else {
newAdded.add(dst);
}
- pm.update(1);
+ advanceOrCancel(pm);
}
added = newAdded;
@@ -498,7 +519,7 @@ public class RenameDetector {
private void findContentRenames(ContentSource.Pair reader,
ProgressMonitor pm)
- throws IOException {
+ throws IOException, CancelledException {
int cnt = Math.max(added.size(), deleted.size());
if (getRenameLimit() == 0 || cnt <= getRenameLimit()) {
SimilarityRenameDetector d;
@@ -516,7 +537,8 @@ public class RenameDetector {
}
@SuppressWarnings("unchecked")
- private void findExactRenames(ProgressMonitor pm) {
+ private void findExactRenames(ProgressMonitor pm)
+ throws CancelledException {
pm.beginTask(JGitText.get().renamesFindingExact, //
added.size() + added.size() + deleted.size()
+ added.size() * deleted.size());
@@ -562,7 +584,7 @@ public class RenameDetector {
} else {
left.add(a);
}
- pm.update(1);
+ advanceOrCancel(pm);
}
for (List<DiffEntry> adds : nonUniqueAdds) {
@@ -604,6 +626,10 @@ public class RenameDetector {
int score = SimilarityRenameDetector.nameScore(addedName, deletedName);
matrix[mNext] = SimilarityRenameDetector.encode(score, delIdx, addIdx);
mNext++;
+ if (pm.isCancelled()) {
+ throw new CancelledException(
+ JGitText.get().renameCancelled);
+ }
}
}
@@ -617,7 +643,7 @@ public class RenameDetector {
DiffEntry a = adds.get(addIdx);
if (a == null) {
- pm.update(1);
+ advanceOrCancel(pm);
continue; // was already matched earlier
}
@@ -635,11 +661,12 @@ public class RenameDetector {
entries.add(DiffEntry.pair(type, d, a, 100));
adds.set(addIdx, null); // Claim the destination was matched.
- pm.update(1);
+ advanceOrCancel(pm);
}
} else {
left.addAll(adds);
}
+ advanceOrCancel(pm);
}
added = left;
@@ -692,7 +719,8 @@ public class RenameDetector {
@SuppressWarnings("unchecked")
private HashMap<AbbreviatedObjectId, Object> populateMap(
- List<DiffEntry> diffEntries, ProgressMonitor pm) {
+ List<DiffEntry> diffEntries, ProgressMonitor pm)
+ throws CancelledException {
HashMap<AbbreviatedObjectId, Object> map = new HashMap<>();
for (DiffEntry de : diffEntries) {
Object old = map.put(id(de), de);
@@ -706,7 +734,7 @@ public class RenameDetector {
((List<DiffEntry>) old).add(de);
map.put(id(de), old);
}
- pm.update(1);
+ advanceOrCancel(pm);
}
return map;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
index 653658be3c..d8a05c34ea 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
@@ -54,6 +54,7 @@ import java.util.List;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.diff.SimilarityIndex.TableFullException;
+import org.eclipse.jgit.errors.CancelledException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.NullProgressMonitor;
@@ -128,7 +129,7 @@ class SimilarityRenameDetector {
renameScore = score;
}
- void compute(ProgressMonitor pm) throws IOException {
+ void compute(ProgressMonitor pm) throws IOException, CancelledException {
if (pm == null)
pm = NullProgressMonitor.INSTANCE;
@@ -142,6 +143,11 @@ class SimilarityRenameDetector {
// we have looked at everything that is above our minimum score.
//
for (--mNext; mNext >= 0; mNext--) {
+ if (pm.isCancelled()) {
+ // TODO(ms): use org.eclipse.jgit.api.errors.CanceledException
+ // in next major version
+ throw new CancelledException(JGitText.get().renameCancelled);
+ }
long ent = matrix[mNext];
int sIdx = srcFile(ent);
int dIdx = dstFile(ent);
@@ -209,7 +215,8 @@ class SimilarityRenameDetector {
return r;
}
- private int buildMatrix(ProgressMonitor pm) throws IOException {
+ private int buildMatrix(ProgressMonitor pm)
+ throws IOException, CancelledException {
// Allocate for the worst-case scenario where every pair has a
// score that we need to consider. We might not need that many.
//
@@ -234,6 +241,14 @@ class SimilarityRenameDetector {
SimilarityIndex s = null;
for (int dstIdx = 0; dstIdx < dsts.size(); dstIdx++) {
+ if (pm.isCancelled()) {
+ // TODO(ms): use
+ // org.eclipse.jgit.api.errors.CanceledException in next
+ // major version
+ throw new CancelledException(
+ JGitText.get().renameCancelled);
+ }
+
DiffEntry dstEnt = dsts.get(dstIdx);
if (!isFile(dstEnt.newMode)) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index 0b03eb1521..bad71de8af 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -1366,7 +1366,11 @@ public class DirCacheCheckout {
* object reader to use for checkout
* @throws java.io.IOException
* @since 3.6
+ * @deprecated since 5.1, use
+ * {@link #checkoutEntry(Repository, DirCacheEntry, ObjectReader, boolean, CheckoutMetadata)}
+ * instead
*/
+ @Deprecated
public static void checkoutEntry(Repository repo, DirCacheEntry entry,
ObjectReader or) throws IOException {
checkoutEntry(repo, entry, or, false, null);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
index b3eee07fb6..45a239da0e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
@@ -55,8 +55,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
import java.util.StringJoiner;
+import java.util.TreeMap;
import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.api.Git;
@@ -124,7 +124,6 @@ public class RepoCommand extends GitCommand<RevCommit> {
private IncludedFileReader includedReader;
private boolean ignoreRemoteFailures = false;
- private List<RepoProject> bareProjects;
private ProgressMonitor monitor;
/**
@@ -519,37 +518,33 @@ public class RepoCommand extends GitCommand<RevCommit> {
}
if (repo.isBare()) {
- bareProjects = new ArrayList<>();
if (author == null)
author = new PersonIdent(repo);
if (callback == null)
callback = new DefaultRemoteReader();
- for (RepoProject proj : filteredProjects) {
- addSubmoduleBare(proj.getUrl(), proj.getPath(),
- proj.getRevision(), proj.getCopyFiles(),
- proj.getLinkFiles(), proj.getGroups(),
- proj.getRecommendShallow());
- }
+ List<RepoProject> renamedProjects = renameProjects(filteredProjects);
+
DirCache index = DirCache.newInCore();
DirCacheBuilder builder = index.builder();
ObjectInserter inserter = repo.newObjectInserter();
try (RevWalk rw = new RevWalk(repo)) {
Config cfg = new Config();
StringBuilder attributes = new StringBuilder();
- for (RepoProject proj : bareProjects) {
+ for (RepoProject proj : renamedProjects) {
+ String name = proj.getName();
String path = proj.getPath();
- String nameUri = proj.getName();
+ String url = proj.getUrl();
ObjectId objectId;
if (ObjectId.isId(proj.getRevision())) {
objectId = ObjectId.fromString(proj.getRevision());
} else {
- objectId = callback.sha1(nameUri, proj.getRevision());
+ objectId = callback.sha1(url, proj.getRevision());
if (objectId == null && !ignoreRemoteFailures) {
- throw new RemoteUnavailableException(nameUri);
+ throw new RemoteUnavailableException(url);
}
if (recordRemoteBranch) {
// can be branch or tag
- cfg.setString("submodule", path, "branch", //$NON-NLS-1$ //$NON-NLS-2$
+ cfg.setString("submodule", name, "branch", //$NON-NLS-1$ //$NON-NLS-2$
proj.getRevision());
}
@@ -559,7 +554,7 @@ public class RepoCommand extends GitCommand<RevCommit> {
// depth in the 'clone-depth' field, while
// git core only uses a binary 'shallow = true/false'
// hint, we'll map any depth to 'shallow = true'
- cfg.setBoolean("submodule", path, "shallow", //$NON-NLS-1$ //$NON-NLS-2$
+ cfg.setBoolean("submodule", name, "shallow", //$NON-NLS-1$ //$NON-NLS-2$
true);
}
}
@@ -575,12 +570,13 @@ public class RepoCommand extends GitCommand<RevCommit> {
attributes.append(rec.toString());
}
- URI submodUrl = URI.create(nameUri);
+ URI submodUrl = URI.create(url);
if (targetUri != null) {
submodUrl = relativize(targetUri, submodUrl);
}
- cfg.setString("submodule", path, "path", path); //$NON-NLS-1$ //$NON-NLS-2$
- cfg.setString("submodule", path, "url", submodUrl.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ cfg.setString("submodule", name, "path", path); //$NON-NLS-1$ //$NON-NLS-2$
+ cfg.setString("submodule", name, "url", //$NON-NLS-1$ //$NON-NLS-2$
+ submodUrl.toString());
// create gitlink
if (objectId != null) {
@@ -591,7 +587,7 @@ public class RepoCommand extends GitCommand<RevCommit> {
for (CopyFile copyfile : proj.getCopyFiles()) {
byte[] src = callback.readFile(
- nameUri, proj.getRevision(), copyfile.src);
+ url, proj.getRevision(), copyfile.src);
objectId = inserter.insert(Constants.OBJ_BLOB, src);
dcEntry = new DirCacheEntry(copyfile.dest);
dcEntry.setObjectId(objectId);
@@ -691,7 +687,7 @@ public class RepoCommand extends GitCommand<RevCommit> {
} else {
try (Git git = new Git(repo)) {
for (RepoProject proj : filteredProjects) {
- addSubmodule(proj.getUrl(), proj.getPath(),
+ addSubmodule(proj.getName(), proj.getUrl(), proj.getPath(),
proj.getRevision(), proj.getCopyFiles(),
proj.getLinkFiles(), git);
}
@@ -703,9 +699,9 @@ public class RepoCommand extends GitCommand<RevCommit> {
}
}
- private void addSubmodule(String url, String path, String revision,
- List<CopyFile> copyfiles, List<LinkFile> linkfiles, Git git)
- throws GitAPIException, IOException {
+ private void addSubmodule(String name, String url, String path,
+ String revision, List<CopyFile> copyfiles, List<LinkFile> linkfiles,
+ Git git) throws GitAPIException, IOException {
assert (!repo.isBare());
assert (git != null);
if (!linkfiles.isEmpty()) {
@@ -713,7 +709,8 @@ public class RepoCommand extends GitCommand<RevCommit> {
JGitText.get().nonBareLinkFilesNotSupported);
}
- SubmoduleAddCommand add = git.submoduleAdd().setPath(path).setURI(url);
+ SubmoduleAddCommand add = git.submoduleAdd().setName(name).setPath(path)
+ .setURI(url);
if (monitor != null)
add.setProgressMonitor(monitor);
@@ -731,16 +728,42 @@ public class RepoCommand extends GitCommand<RevCommit> {
}
}
- private void addSubmoduleBare(String url, String path, String revision,
- List<CopyFile> copyfiles, List<LinkFile> linkfiles,
- Set<String> groups, String recommendShallow) {
- assert (repo.isBare());
- assert (bareProjects != null);
- RepoProject proj = new RepoProject(url, path, revision, null, groups,
- recommendShallow);
- proj.addCopyFiles(copyfiles);
- proj.addLinkFiles(linkfiles);
- bareProjects.add(proj);
+ /**
+ * Rename the projects if there's a conflict when converted to submodules.
+ *
+ * @param projects
+ * parsed projects
+ * @return projects that are renamed if necessary
+ */
+ private List<RepoProject> renameProjects(List<RepoProject> projects) {
+ Map<String, List<RepoProject>> m = new TreeMap<>();
+ for (RepoProject proj : projects) {
+ List<RepoProject> l = m.get(proj.getName());
+ if (l == null) {
+ l = new ArrayList<>();
+ m.put(proj.getName(), l);
+ }
+ l.add(proj);
+ }
+
+ List<RepoProject> ret = new ArrayList<>();
+ for (List<RepoProject> ps : m.values()) {
+ boolean nameConflict = ps.size() != 1;
+ for (RepoProject proj : ps) {
+ String name = proj.getName();
+ if (nameConflict) {
+ name += SLASH + proj.getPath();
+ }
+ RepoProject p = new RepoProject(name,
+ proj.getPath(), proj.getRevision(), null,
+ proj.getGroups(), proj.getRecommendShallow());
+ p.setUrl(proj.getUrl());
+ p.addCopyFiles(proj.getCopyFiles());
+ p.addLinkFiles(proj.getLinkFiles());
+ ret.add(p);
+ }
+ }
+ return ret;
}
/*
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index 69181881ed..2373b97bd1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -110,6 +110,7 @@ public class JGitText extends TranslationBundle {
/***/ public String buildingBitmaps;
/***/ public String cachedPacksPreventsIndexCreation;
/***/ public String cachedPacksPreventsListingObjects;
+ /***/ public String cannotAccessLastModifiedForSafeDeletion;
/***/ public String cannotBeCombined;
/***/ public String cannotBeRecursiveWhenTreesAreIncluded;
/***/ public String cannotChangeActionOnComment;
@@ -639,6 +640,7 @@ public class JGitText extends TranslationBundle {
/***/ public String renameBranchFailedBecauseTag;
/***/ public String renameBranchFailedUnknownReason;
/***/ public String renameBranchUnexpectedResult;
+ /***/ public String renameCancelled;
/***/ public String renameFileFailed;
/***/ public String renamesAlreadyFound;
/***/ public String renamesBreakingModifies;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
index 342e2c842c..3fab484f29 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
@@ -77,15 +77,12 @@ import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.jgit.annotations.NonNull;
-import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.errors.CancelledException;
import org.eclipse.jgit.errors.CorruptObjectException;
@@ -248,8 +245,11 @@ public class GC {
*/
// TODO(ms): in 5.0 change signature and return Future<Collection<PackFile>>
public Collection<PackFile> gc() throws IOException, ParseException {
- final GcLog gcLog = background ? new GcLog(repo) : null;
- if (gcLog != null && !gcLog.lock(background)) {
+ if (!background) {
+ return doGc();
+ }
+ final GcLog gcLog = new GcLog(repo);
+ if (!gcLog.lock()) {
// there is already a background gc running
return Collections.emptyList();
}
@@ -257,48 +257,31 @@ public class GC {
Callable<Collection<PackFile>> gcTask = () -> {
try {
Collection<PackFile> newPacks = doGc();
- if (automatic && tooManyLooseObjects() && gcLog != null) {
+ if (automatic && tooManyLooseObjects()) {
String message = JGitText.get().gcTooManyUnpruned;
gcLog.write(message);
gcLog.commit();
}
return newPacks;
} catch (IOException | ParseException e) {
- if (background) {
- if (gcLog == null) {
- // Lacking a log, there's no way to report this.
- return Collections.emptyList();
- }
- try {
- gcLog.write(e.getMessage());
- StringWriter sw = new StringWriter();
- e.printStackTrace(new PrintWriter(sw));
- gcLog.write(sw.toString());
- gcLog.commit();
- } catch (IOException e2) {
- e2.addSuppressed(e);
- LOG.error(e2.getMessage(), e2);
- }
- } else {
- throw new JGitInternalException(e.getMessage(), e);
+ try {
+ gcLog.write(e.getMessage());
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ gcLog.write(sw.toString());
+ gcLog.commit();
+ } catch (IOException e2) {
+ e2.addSuppressed(e);
+ LOG.error(e2.getMessage(), e2);
}
} finally {
- if (gcLog != null) {
- gcLog.unlock();
- }
+ gcLog.unlock();
}
return Collections.emptyList();
};
- Future<Collection<PackFile>> result = executor().submit(gcTask);
- if (background) {
- // TODO(ms): in 5.0 change signature and return the Future
- return Collections.emptyList();
- }
- try {
- return result.get();
- } catch (InterruptedException | ExecutionException e) {
- throw new IOException(e);
- }
+ // TODO(ms): in 5.0 change signature and return the Future
+ executor().submit(gcTask);
+ return Collections.emptyList();
}
private ExecutorService executor() {
@@ -922,17 +905,32 @@ public class GC {
}
private void deleteEmptyRefsFolders() throws IOException {
- Path refs = repo.getDirectory().toPath().resolve("refs"); //$NON-NLS-1$
+ Path refs = repo.getDirectory().toPath().resolve(Constants.R_REFS);
+ // Avoid deleting a folder that was created after the threshold so that concurrent
+ // operations trying to create a reference are not impacted
+ Instant threshold = Instant.now().minus(30, ChronoUnit.SECONDS);
try (Stream<Path> entries = Files.list(refs)) {
Iterator<Path> iterator = entries.iterator();
while (iterator.hasNext()) {
try (Stream<Path> s = Files.list(iterator.next())) {
- s.forEach(this::deleteDir);
+ s.filter(path -> canBeSafelyDeleted(path, threshold)).forEach(this::deleteDir);
}
}
}
}
+ private boolean canBeSafelyDeleted(Path path, Instant threshold) {
+ try {
+ return Files.getLastModifiedTime(path).toInstant().isBefore(threshold);
+ }
+ catch (IOException e) {
+ LOG.warn(MessageFormat.format(
+ JGitText.get().cannotAccessLastModifiedForSafeDeletion,
+ path), e);
+ return false;
+ }
+ }
+
private void deleteDir(Path dir) {
try (Stream<Path> dirs = Files.walk(dir)) {
dirs.filter(this::isDirectory).sorted(Comparator.reverseOrder())
@@ -946,22 +944,13 @@ public class GC {
return p.toFile().isDirectory();
}
- private boolean delete(Path d) {
+ private void delete(Path d) {
try {
- // Avoid deleting a folder that was just created so that concurrent
- // operations trying to create a reference are not impacted
- Instant threshold = Instant.now().minus(30, ChronoUnit.SECONDS);
- Instant lastModified = Files.getLastModifiedTime(d).toInstant();
- if (lastModified.isBefore(threshold)) {
- // If the folder is not empty, the delete operation will fail
- // silently. This is a cheaper alternative to filtering the
- // stream in the calling method.
- return d.toFile().delete();
- }
+ Files.delete(d);
} catch (IOException e) {
- LOG.error(e.getMessage(), e);
+ LOG.error(MessageFormat.format(JGitText.get().cannotDeleteFile, d),
+ e);
}
- return false;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
index c159a94705..0e587ce827 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
@@ -45,18 +45,15 @@ package org.eclipse.jgit.internal.storage.file;
import static org.eclipse.jgit.lib.Constants.CHARSET;
-import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.attribute.FileTime;
-import java.text.MessageFormat;
import java.text.ParseException;
import java.time.Instant;
import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.GitDateParser;
@@ -104,22 +101,11 @@ class GcLog {
return gcLogExpire;
}
- private boolean autoGcBlockedByOldLockFile(boolean background) {
+ private boolean autoGcBlockedByOldLockFile() {
try {
FileTime lastModified = Files.getLastModifiedTime(FileUtils.toPath(logFile));
if (lastModified.toInstant().compareTo(getLogExpiry()) > 0) {
// There is an existing log file, which is too recent to ignore
- if (!background) {
- try (BufferedReader reader = Files
- .newBufferedReader(FileUtils.toPath(logFile))) {
- char[] buf = new char[1000];
- int len = reader.read(buf, 0, 1000);
- String oldError = new String(buf, 0, len);
-
- throw new JGitInternalException(MessageFormat.format(
- JGitText.get().gcLogExists, oldError, logFile));
- }
- }
return true;
}
} catch (NoSuchFileException e) {
@@ -133,11 +119,9 @@ class GcLog {
/**
* Lock the GC log file for updates
*
- * @param background
- * If true, and if gc.log already exists, unlock and return false
* @return {@code true} if we hold the lock
*/
- boolean lock(boolean background) {
+ boolean lock() {
try {
if (!lock.lock()) {
return false;
@@ -145,7 +129,7 @@ class GcLog {
} catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
}
- if (autoGcBlockedByOldLockFile(background)) {
+ if (autoGcBlockedByOldLockFile()) {
lock.unlock();
return false;
}
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 a27b99157c..836cd2cc6e 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
@@ -1285,8 +1285,11 @@ public class RefDirectory extends RefDatabase {
}
File dir = file.getParentFile();
for (int i = 0; i < depth; ++i) {
- if (!dir.delete()) {
- break; // ignore problem here
+ try {
+ Files.delete(dir.toPath());
+ } catch (IOException e) {
+ LOG.warn("Unable to remove path {}", dir, e);
+ break;
}
dir = dir.getParentFile();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
index 5a790350b1..d4a0280da6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -49,7 +49,7 @@ package org.eclipse.jgit.lib;
* configuration keys
*/
@SuppressWarnings("nls")
-public class ConfigConstants {
+public final class ConfigConstants {
/** The "core" section */
public static final String CONFIG_CORE_SECTION = "core";
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
index ecebd54089..9a4a3a2a01 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
@@ -687,11 +687,23 @@ public final class Constants {
*/
public static final String COMMIT_EDITMSG = "COMMIT_EDITMSG";
- /** objectid for the empty blob */
+ /**
+ * Well-known object ID for the empty blob.
+ *
+ * @since 0.9.1
+ */
public static final ObjectId EMPTY_BLOB_ID = ObjectId
.fromString("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
/**
+ * Well-known object ID for the empty tree.
+ *
+ * @since 5.1
+ */
+ public static final ObjectId EMPTY_TREE_ID = ObjectId
+ .fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
+
+ /**
* Suffix of lock file name
*
* @since 5.0
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
index 3042fdd3f4..f60c95f647 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -78,6 +78,7 @@ import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.dircache.DirCacheBuildIterator;
import org.eclipse.jgit.dircache.DirCacheBuilder;
import org.eclipse.jgit.dircache.DirCacheCheckout;
+import org.eclipse.jgit.dircache.DirCacheCheckout.CheckoutMetadata;
import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.errors.BinaryBlobException;
import org.eclipse.jgit.errors.CorruptObjectException;
@@ -297,6 +298,12 @@ public class ResolveMerger extends ThreeWayMerger {
*/
private int inCoreLimit;
+ /**
+ * Keeps {@link CheckoutMetadata} for {@link #checkout()} and
+ * {@link #cleanUp()}.
+ */
+ private Map<String, CheckoutMetadata> checkoutMetadata;
+
private static MergeAlgorithm getMergeAlgorithm(Config config) {
SupportedAlgorithm diffAlg = config.getEnum(
CONFIG_DIFF_SECTION, null, CONFIG_KEY_ALGORITHM,
@@ -313,6 +320,8 @@ public class ResolveMerger extends ThreeWayMerger {
return new String[] { "BASE", "OURS", "THEIRS" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ private static final Attributes NO_ATTRIBUTES = new Attributes();
+
/**
* Constructor for ResolveMerger.
*
@@ -369,15 +378,20 @@ public class ResolveMerger extends ThreeWayMerger {
/** {@inheritDoc} */
@Override
protected boolean mergeImpl() throws IOException {
- if (implicitDirCache)
+ if (implicitDirCache) {
dircache = nonNullRepo().lockDirCache();
-
+ }
+ if (!inCore) {
+ checkoutMetadata = new HashMap<>();
+ }
try {
return mergeTrees(mergeBase(), sourceTrees[0], sourceTrees[1],
false);
} finally {
- if (implicitDirCache)
+ checkoutMetadata = null;
+ if (implicitDirCache) {
dircache.unlock();
+ }
}
}
@@ -400,7 +414,8 @@ public class ResolveMerger extends ThreeWayMerger {
if (cacheEntry.getFileMode() == FileMode.GITLINK) {
new File(nonNullRepo().getWorkTree(), entry.getKey()).mkdirs();
} else {
- DirCacheCheckout.checkoutEntry(db, cacheEntry, reader);
+ DirCacheCheckout.checkoutEntry(db, cacheEntry, reader, false,
+ checkoutMetadata.get(entry.getKey()));
modifiedFiles.add(entry.getKey());
}
}
@@ -428,10 +443,12 @@ public class ResolveMerger extends ThreeWayMerger {
DirCache dc = nonNullRepo().readDirCache();
Iterator<String> mpathsIt=modifiedFiles.iterator();
while(mpathsIt.hasNext()) {
- String mpath=mpathsIt.next();
+ String mpath = mpathsIt.next();
DirCacheEntry entry = dc.getEntry(mpath);
- if (entry != null)
- DirCacheCheckout.checkoutEntry(db, entry, reader);
+ if (entry != null) {
+ DirCacheCheckout.checkoutEntry(db, entry, reader, false,
+ checkoutMetadata.get(mpath));
+ }
mpathsIt.remove();
}
}
@@ -481,6 +498,71 @@ public class ResolveMerger extends ThreeWayMerger {
}
/**
+ * Remembers the {@link CheckoutMetadata} for the given path; it may be
+ * needed in {@link #checkout()} or in {@link #cleanUp()}.
+ *
+ * @param path
+ * of the current node
+ * @param attributes
+ * for the current node
+ * @throws IOException
+ * if the smudge filter cannot be determined
+ * @since 5.1
+ */
+ protected void addCheckoutMetadata(String path, Attributes attributes)
+ throws IOException {
+ if (checkoutMetadata != null) {
+ EolStreamType eol = EolStreamTypeUtil.detectStreamType(
+ OperationType.CHECKOUT_OP, workingTreeOptions, attributes);
+ CheckoutMetadata data = new CheckoutMetadata(eol,
+ tw.getFilterCommand(Constants.ATTR_FILTER_TYPE_SMUDGE));
+ checkoutMetadata.put(path, data);
+ }
+ }
+
+ /**
+ * Adds a {@link DirCacheEntry} for direct checkout and remembers its
+ * {@link CheckoutMetadata}.
+ *
+ * @param path
+ * of the entry
+ * @param entry
+ * to add
+ * @param attributes
+ * for the current entry
+ * @throws IOException
+ * if the {@link CheckoutMetadata} cannot be determined
+ * @since 5.1
+ */
+ protected void addToCheckout(String path, DirCacheEntry entry,
+ Attributes attributes) throws IOException {
+ toBeCheckedOut.put(path, entry);
+ addCheckoutMetadata(path, attributes);
+ }
+
+ /**
+ * Remember a path for deletion, and remember its {@link CheckoutMetadata}
+ * in case it has to be restored in {@link #cleanUp()}.
+ *
+ * @param path
+ * of the entry
+ * @param isFile
+ * whether it is a file
+ * @param attributes
+ * for the entry
+ * @throws IOException
+ * if the {@link CheckoutMetadata} cannot be determined
+ * @since 5.1
+ */
+ protected void addDeletion(String path, boolean isFile,
+ Attributes attributes) throws IOException {
+ toBeDeleted.add(path);
+ if (isFile) {
+ addCheckoutMetadata(path, attributes);
+ }
+ }
+
+ /**
* Processes one path and tries to merge taking git attributes in account.
* This method will do all trivial (not content) merges and will also detect
* if a merge will fail. The merge will fail when one of the following is
@@ -586,7 +668,7 @@ public class ResolveMerger extends ThreeWayMerger {
// This will happen later. Set these values to 0 for know.
DirCacheEntry e = add(tw.getRawPath(), theirs,
DirCacheEntry.STAGE_0, 0, 0);
- toBeCheckedOut.put(tw.getPathString(), e);
+ addToCheckout(tw.getPathString(), e, attributes);
}
return true;
} else {
@@ -627,8 +709,9 @@ public class ResolveMerger extends ThreeWayMerger {
// This will happen later. Set these values to 0 for know.
DirCacheEntry e = add(tw.getRawPath(), theirs,
DirCacheEntry.STAGE_0, 0, 0);
- if (e != null)
- toBeCheckedOut.put(tw.getPathString(), e);
+ if (e != null) {
+ addToCheckout(tw.getPathString(), e, attributes);
+ }
return true;
} else {
// we want THEIRS ... but THEIRS contains a folder or the
@@ -642,7 +725,7 @@ public class ResolveMerger extends ThreeWayMerger {
// Base, ours, and theirs all contain a folder: don't delete
return true;
}
- toBeDeleted.add(tw.getPathString());
+ addDeletion(tw.getPathString(), nonTree(modeO), attributes);
return true;
}
}
@@ -726,9 +809,12 @@ public class ResolveMerger extends ThreeWayMerger {
result.setContainsConflicts(false);
}
updateIndex(base, ours, theirs, result, attributes);
- if (result.containsConflicts() && !ignoreConflicts)
- unmergedPaths.add(tw.getPathString());
- modifiedFiles.add(tw.getPathString());
+ String currentPath = tw.getPathString();
+ if (result.containsConflicts() && !ignoreConflicts) {
+ unmergedPaths.add(currentPath);
+ }
+ modifiedFiles.add(currentPath);
+ addCheckoutMetadata(currentPath, attributes);
} else if (modeO != modeT) {
// OURS or THEIRS has been deleted
if (((modeO != 0 && !tw.idEqual(T_BASE, T_OURS)) || (modeT != 0 && !tw
@@ -747,8 +833,9 @@ public class ResolveMerger extends ThreeWayMerger {
if (isWorktreeDirty(work, ourDce))
return false;
if (nonTree(modeT)) {
- if (e != null)
- toBeCheckedOut.put(tw.getPathString(), e);
+ if (e != null) {
+ addToCheckout(tw.getPathString(), e, attributes);
+ }
}
}
@@ -1249,7 +1336,8 @@ public class ResolveMerger extends ThreeWayMerger {
hasWorkingTreeIterator ? treeWalk.getTree(T_FILE,
WorkingTreeIterator.class) : null,
ignoreConflicts, hasAttributeNodeProvider
- ? treeWalk.getAttributes() : new Attributes())) {
+ ? treeWalk.getAttributes()
+ : NO_ATTRIBUTES)) {
cleanUp();
return false;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CapabilitiesV2Request.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CapabilitiesV2Request.java
new file mode 100644
index 0000000000..b133ab579a
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CapabilitiesV2Request.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2018, Google LLC.
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.eclipse.jgit.transport;
+
+/**
+ * Capabilities protocol v2 request.
+ *
+ * <p>
+ * This is used as an input to {@link ProtocolV2Hook}.
+ *
+ * @since 5.1
+ */
+public final class CapabilitiesV2Request {
+ private CapabilitiesV2Request() {
+ }
+
+ /** @return A builder of {@link CapabilitiesV2Request}. */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /** A builder for {@link CapabilitiesV2Request}. */
+ public static final class Builder {
+ private Builder() {
+ }
+
+ /** @return CapabilitiesV2Request */
+ public CapabilitiesV2Request build() {
+ return new CapabilitiesV2Request();
+ }
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
index 10cd775304..760ac6c1d7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
@@ -50,7 +50,7 @@ package org.eclipse.jgit.transport;
*
* @since 3.2
*/
-public class GitProtocolConstants {
+public final class GitProtocolConstants {
/**
* Include tags if we are also including the referenced objects.
*
@@ -167,6 +167,13 @@ public class GitProtocolConstants {
public static final String OPTION_FILTER = "filter"; //$NON-NLS-1$
/**
+ * The client specified a want-ref expression.
+ *
+ * @since 5.1
+ */
+ public static final String OPTION_WANT_REF = "want-ref"; //$NON-NLS-1$
+
+ /**
* The client supports atomic pushes. If this option is used, the server
* will update all refs within one atomic transaction.
*
@@ -231,6 +238,13 @@ public class GitProtocolConstants {
public static final String CAPABILITY_PUSH_OPTIONS = "push-options"; //$NON-NLS-1$
/**
+ * The server supports the client specifying ref names.
+ *
+ * @since 5.1
+ */
+ public static final String CAPABILITY_REF_IN_WANT = "ref-in-want"; //$NON-NLS-1$
+
+ /**
* The server supports listing refs using protocol v2.
*
* @since 5.0
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
index 1d5248a15d..eab3b3c0cc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
@@ -372,6 +372,8 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory {
*/
protected JSch createDefaultJSch(FS fs) throws JSchException {
final JSch jsch = new JSch();
+ JSch.setConfig("ssh-rsa", JSch.getConfig("signature.rsa")); //$NON-NLS-1$ //$NON-NLS-2$
+ JSch.setConfig("ssh-dss", JSch.getConfig("signature.dss")); //$NON-NLS-1$ //$NON-NLS-2$
configureJSch(jsch);
knownHosts(jsch, fs);
identities(jsch, fs);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java
new file mode 100644
index 0000000000..3aff584a00
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2018, Google LLC.
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.eclipse.jgit.transport;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * ls-refs protocol v2 request.
+ *
+ * <p>
+ * This is used as an input to {@link ProtocolV2Hook}.
+ *
+ * @since 5.1
+ */
+public final class LsRefsV2Request {
+ private final List<String> refPrefixes;
+
+ private final boolean symrefs;
+
+ private final boolean peel;
+
+ private LsRefsV2Request(List<String> refPrefixes, boolean symrefs,
+ boolean peel) {
+ this.refPrefixes = refPrefixes;
+ this.symrefs = symrefs;
+ this.peel = peel;
+ }
+
+ /** @return ref prefixes that the client requested. */
+ public List<String> getRefPrefixes() {
+ return refPrefixes;
+ }
+
+ /** @return true if the client requests symbolic references. */
+ public boolean getSymrefs() {
+ return symrefs;
+ }
+
+ /** @return true if the client requests tags to be peeled. */
+ public boolean getPeel() {
+ return peel;
+ }
+
+ /** @return A builder of {@link LsRefsV2Request}. */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /** A builder for {@link LsRefsV2Request}. */
+ public static final class Builder {
+ private List<String> refPrefixes = Collections.emptyList();
+
+ private boolean symrefs;
+
+ private boolean peel;
+
+ private Builder() {
+ }
+
+ /**
+ * @param value
+ * @return the Builder
+ */
+ public Builder setRefPrefixes(List<String> value) {
+ refPrefixes = value;
+ return this;
+ }
+
+ /**
+ * @param value
+ * @return the Builder
+ */
+ public Builder setSymrefs(boolean value) {
+ symrefs = value;
+ return this;
+ }
+
+ /**
+ * @param value
+ * @return the Builder
+ */
+ public Builder setPeel(boolean value) {
+ peel = value;
+ return this;
+ }
+
+ /** @return LsRefsV2Request */
+ public LsRefsV2Request build() {
+ return new LsRefsV2Request(
+ Collections.unmodifiableList(refPrefixes), symrefs, peel);
+ }
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Hook.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Hook.java
new file mode 100644
index 0000000000..02760fdde4
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Hook.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2018, Google LLC.
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.eclipse.jgit.transport;
+
+/**
+ * Hook to allow callers to be notified on Git protocol v2 requests.
+ *
+ * @see UploadPack#setProtocolV2Hook(ProtocolV2Hook)
+ * @since 5.1
+ */
+public interface ProtocolV2Hook {
+ /**
+ * The default hook implementation that does nothing.
+ */
+ static ProtocolV2Hook DEFAULT = new ProtocolV2Hook() {
+ // No override.
+ };
+
+ /**
+ * @param req
+ * the capabilities request
+ * @throws ServiceMayNotContinueException
+ * abort; the message will be sent to the user
+ * @since 5.1
+ */
+ default void onCapabilities(CapabilitiesV2Request req)
+ throws ServiceMayNotContinueException {
+ // Do nothing by default.
+ }
+
+ /**
+ * @param req
+ * the ls-refs request
+ * @throws ServiceMayNotContinueException
+ * abort; the message will be sent to the user
+ * @since 5.1
+ */
+ default void onLsRefs(LsRefsV2Request req)
+ throws ServiceMayNotContinueException {
+ // Do nothing by default.
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
index 4ae1ccb420..6b8d5c598e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
@@ -126,6 +126,7 @@ public class TransferConfig {
private final boolean allowInvalidPersonIdent;
private final boolean safeForWindows;
private final boolean safeForMacOS;
+ private final boolean allowRefInWant;
private final boolean allowTipSha1InWant;
private final boolean allowReachableSha1InWant;
private final boolean allowFilter;
@@ -180,6 +181,7 @@ public class TransferConfig {
ignore.add(ObjectChecker.ErrorType.ZERO_PADDED_FILEMODE);
}
+ allowRefInWant = rc.getBoolean("uploadpack", "allowrefinwant", false);
allowTipSha1InWant = rc.getBoolean(
"uploadpack", "allowtipsha1inwant", false);
allowReachableSha1InWant = rc.getBoolean(
@@ -262,6 +264,14 @@ public class TransferConfig {
}
/**
+ * @return true if clients are allowed to specify a "want-ref" line
+ * @since 5.1
+ */
+ public boolean isAllowRefInWant() {
+ return allowRefInWant;
+ }
+
+ /**
* Get {@link org.eclipse.jgit.transport.RefFilter} respecting configured
* hidden refs.
*
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index 7de0506bb3..de7be6dec5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.transport;
import static org.eclipse.jgit.lib.Constants.R_TAGS;
import static org.eclipse.jgit.lib.RefDatabase.ALL;
+import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_REF_IN_WANT;
import static org.eclipse.jgit.transport.GitProtocolConstants.COMMAND_FETCH;
import static org.eclipse.jgit.transport.GitProtocolConstants.COMMAND_LS_REFS;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_AGENT;
@@ -62,6 +63,7 @@ import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SHALLOW;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SIDE_BAND;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SIDE_BAND_64K;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_THIN_PACK;
+import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_WANT_REF;
import java.io.ByteArrayOutputStream;
import java.io.EOFException;
@@ -77,6 +79,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.errors.CorruptObjectException;
@@ -264,6 +267,9 @@ public class UploadPack {
/** The refs we advertised as existing at the start of the connection. */
private Map<String, Ref> refs;
+ /** Hook used while processing Git protocol v2 requests. */
+ private ProtocolV2Hook protocolV2Hook = ProtocolV2Hook.DEFAULT;
+
/** Hook used while advertising the refs to the client. */
private AdvertiseRefsHook advertiseRefsHook = AdvertiseRefsHook.DEFAULT;
@@ -576,6 +582,16 @@ public class UploadPack {
}
/**
+ * Set the protocol V2 hook.
+ *
+ * @param hook
+ * @since 5.1
+ */
+ public void setProtocolV2Hook(ProtocolV2Hook hook) {
+ this.protocolV2Hook = hook;
+ }
+
+ /**
* Set the filter used while advertising the refs to the client.
* <p>
* Only refs allowed by this filter will be sent to the client. The filter
@@ -877,25 +893,19 @@ public class UploadPack {
}
private void lsRefsV2() throws IOException {
- PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut);
- String line;
- ArrayList<String> refPrefixes = new ArrayList<>();
- boolean needToFindSymrefs = false;
-
- adv.setUseProtocolV2(true);
-
- line = pckIn.readString();
-
+ LsRefsV2Request.Builder builder = LsRefsV2Request.builder();
+ List<String> prefixes = new ArrayList<>();
+ String line = pckIn.readString();
// Currently, we do not support any capabilities, so the next
// line is DELIM if there are arguments or END if not.
if (line == PacketLineIn.DELIM) {
while ((line = pckIn.readString()) != PacketLineIn.END) {
if (line.equals("peel")) { //$NON-NLS-1$
- adv.setDerefTags(true);
+ builder.setPeel(true);
} else if (line.equals("symrefs")) { //$NON-NLS-1$
- needToFindSymrefs = true;
+ builder.setSymrefs(true);
} else if (line.startsWith("ref-prefix ")) { //$NON-NLS-1$
- refPrefixes.add(line.substring("ref-prefix ".length())); //$NON-NLS-1$
+ prefixes.add(line.substring("ref-prefix ".length())); //$NON-NLS-1$
} else {
throw new PackProtocolException(MessageFormat
.format(JGitText.get().unexpectedPacketLine, line));
@@ -905,21 +915,28 @@ public class UploadPack {
throw new PackProtocolException(MessageFormat
.format(JGitText.get().unexpectedPacketLine, line));
}
- rawOut.stopBuffering();
+ LsRefsV2Request req = builder.setRefPrefixes(prefixes).build();
+ protocolV2Hook.onLsRefs(req);
+
+ rawOut.stopBuffering();
+ PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut);
+ adv.setUseProtocolV2(true);
+ if (req.getPeel()) {
+ adv.setDerefTags(true);
+ }
Map<String, Ref> refsToSend;
- if (refPrefixes.isEmpty()) {
+ if (req.getRefPrefixes().isEmpty()) {
refsToSend = getAdvertisedOrDefaultRefs();
} else {
refsToSend = new HashMap<>();
- for (String refPrefix : refPrefixes) {
+ for (String refPrefix : req.getRefPrefixes()) {
for (Ref ref : db.getRefDatabase().getRefsByPrefix(refPrefix)) {
refsToSend.put(ref.getName(), ref);
}
}
}
-
- if (needToFindSymrefs) {
+ if (req.getSymrefs()) {
findSymrefs(adv, refsToSend);
}
@@ -959,9 +976,27 @@ public class UploadPack {
boolean includeTag = false;
boolean filterReceived = false;
+ TreeMap<String, ObjectId> wantedRefs = new TreeMap<>();
while ((line = pckIn.readString()) != PacketLineIn.END) {
if (line.startsWith("want ")) { //$NON-NLS-1$
wantIds.add(ObjectId.fromString(line.substring(5)));
+ } else if (transferConfig.isAllowRefInWant() &&
+ line.startsWith(OPTION_WANT_REF + " ")) { //$NON-NLS-1$
+ String refName = line.substring(OPTION_WANT_REF.length() + 1);
+ Ref ref = db.getRefDatabase().exactRef(refName);
+ if (ref == null) {
+ throw new PackProtocolException(
+ MessageFormat.format(JGitText.get().invalidRefName,
+ refName));
+ }
+ ObjectId oid = ref.getObjectId();
+ if (oid == null) {
+ throw new PackProtocolException(
+ MessageFormat.format(JGitText.get().invalidRefName,
+ refName));
+ }
+ wantedRefs.put(refName, oid);
+ wantIds.add(oid);
} else if (line.startsWith("have ")) { //$NON-NLS-1$
peerHas.add(ObjectId.fromString(line.substring(5)));
} else if (line.equals("done")) { //$NON-NLS-1$
@@ -1075,6 +1110,18 @@ public class UploadPack {
sectionSent = true;
}
+ if (!wantedRefs.isEmpty()) {
+ if (sectionSent) {
+ pckOut.writeDelim();
+ }
+ pckOut.writeString("wanted-refs\n"); //$NON-NLS-1$
+ for (Map.Entry<String, ObjectId> entry : wantedRefs.entrySet()) {
+ pckOut.writeString(entry.getValue().getName() + ' ' +
+ entry.getKey() + '\n');
+ }
+ sectionSent = true;
+ }
+
if (sectionSent)
pckOut.writeDelim();
pckOut.writeString("packfile\n"); //$NON-NLS-1$
@@ -1083,8 +1130,12 @@ public class UploadPack {
? db.getRefDatabase().getRefsByPrefix(R_TAGS)
: null,
unshallowCommits);
+ // sendPack invokes pckOut.end() for us, so we do not
+ // need to invoke it here.
+ } else {
+ // Invoke pckOut.end() by ourselves.
+ pckOut.end();
}
- pckOut.end();
}
/*
@@ -1121,9 +1172,12 @@ public class UploadPack {
ArrayList<String> caps = new ArrayList<>();
caps.add("version 2"); //$NON-NLS-1$
caps.add(COMMAND_LS_REFS);
+ boolean advertiseRefInWant = transferConfig.isAllowRefInWant() &&
+ db.getConfig().getBoolean("uploadpack", null, "advertiserefinwant", true);
caps.add(
COMMAND_FETCH + '=' +
(transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "") + //$NON-NLS-1$
+ (advertiseRefInWant ? CAPABILITY_REF_IN_WANT + ' ' : "") + //$NON-NLS-1$
OPTION_SHALLOW);
return caps;
}
@@ -1134,6 +1188,8 @@ public class UploadPack {
// is sent only if this is a bidirectional pipe. (If
// not, the client is expected to call
// sendAdvertisedRefs() on its own.)
+ protocolV2Hook
+ .onCapabilities(CapabilitiesV2Request.builder().build());
for (String s : getV2CapabilityAdvertisement()) {
pckOut.writeString(s + "\n"); //$NON-NLS-1$
}
@@ -1298,6 +1354,8 @@ public class UploadPack {
if (useProtocolV2()) {
// The equivalent in v2 is only the capabilities
// advertisement.
+ protocolV2Hook
+ .onCapabilities(CapabilitiesV2Request.builder().build());
for (String s : getV2CapabilityAdvertisement()) {
adv.writeOne(s);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
index a2923db9dd..3abf4dc5e5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
@@ -389,7 +389,7 @@ public class FS_POSIX extends FS {
Integer nlink = (Integer) (Files.getAttribute(lockPath,
"unix:nlink")); //$NON-NLS-1$
if (nlink != 2) {
- LOG.warn("nlink of link to lock file {0} was not 2 but {1}", //$NON-NLS-1$
+ LOG.warn("nlink of link to lock file {} was not 2 but {}", //$NON-NLS-1$
lock.getPath(), nlink);
return false;
}
diff --git a/pom.xml b/pom.xml
index 2758844ff0..aee4895361 100644
--- a/pom.xml
+++ b/pom.xml
@@ -207,10 +207,10 @@
<commons-compress-version>1.15</commons-compress-version>
<osgi-core-version>4.3.1</osgi-core-version>
<servlet-api-version>3.1.0</servlet-api-version>
- <jetty-version>9.4.8.v20171121</jetty-version>
+ <jetty-version>9.4.11.v20180605</jetty-version>
<japicmp-version>0.12.0</japicmp-version>
- <httpclient-version>4.5.2</httpclient-version>
- <httpcore-version>4.4.6</httpcore-version>
+ <httpclient-version>4.5.5</httpclient-version>
+ <httpcore-version>4.4.9</httpcore-version>
<slf4j-version>1.7.2</slf4j-version>
<log4j-version>1.2.15</log4j-version>
<maven-javadoc-plugin-version>3.0.1</maven-javadoc-plugin-version>
@@ -772,6 +772,9 @@
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
+ <compilerArgs>
+ <arg>-Xep:ExpectedExceptionChecker:ERROR</arg>
+ </compilerArgs>
<excludes>
<exclude>org/eclipse/jgit/transport/InsecureCipherFactory.java</exclude>
</excludes>