Merge branch 'stable-5.1'
* stable-5.1:
Prepare 5.1.4-SNAPSHOT builds
JGit v5.1.3.201810200350-r
Prepare 4.11.6-SNAPSHOT builds
JGit v4.11.5.201810191925-r
Prepare 4.9.8-SNAPSHOT builds
JGit v4.9.7.201810191756-r
Update API problem filter
Prepare 4.7.7-SNAPSHOT builds
JGit v4.7.6.201810191618-r
Update API problem filter
Fix file handle leak in ObjectDownloadListener.onWritePossible
Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml
Replace FindBugs with SpotBugs
Prepare 4.4.2-SNAPSHOT builds
JGit v4.0.3.201509231615-r
Change-Id: Ic8b2189fdd8403294327a17cc0c1f6a6e2f78cb8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
diff --git a/.mailmap b/.mailmap
index 7c9dc3d..f0bc990 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1,10 +1,18 @@
-Han-Wen Nienhuys <hanwen@google.com> Han-Wen NIenhuys <hanwen@google.com>
-Mark Ingram <markdingram@gmail.com> markdingram <markdingram@gmail.com>
-Roberto Tyley <roberto.tyley@guardian.co.uk> roberto <roberto.tyley@guardian.co.uk>
-Saša Živkov <sasa.zivkov@sap.com> Sasa Zivkov <sasa.zivkov@sap.com>
-Saša Živkov <sasa.zivkov@sap.com> Saša Živkov <zivkov@gmail.com>
-Saša Živkov <sasa.zivkov@sap.com> Sasa Zivkov <zivkov@gmail.com>
-Shawn Pearce <spearce@spearce.org> Shawn O. Pearce <sop@google.com>
-Shawn Pearce <spearce@spearce.org> Shawn Pearce <sop@google.com>
-Shawn Pearce <spearce@spearce.org> Shawn O. Pearce <spearce@spearce.org>
-Terry Parker <tparker@google.com> tparker <tparker@google.com>
+Chris Aniszczyk <caniszczyk@gmail.com> Chris Aniszczyk <zx@eclipsesource.com>
+Christian Halstrick <christian.halstrick@sap.com> Christian Halstrick <christian.halstrick@gmail.com>
+Dani Megert <Daniel_Megert@ch.ibm.com> Daniel Megert <daniel_megert@ch.ibm.com>
+David Pursehouse <david.pursehouse@gmail.com> David Pursehouse <david.pursehouse@sonymobile.com>
+Han-Wen Nienhuys <hanwen@google.com> Han-Wen NIenhuys <hanwen@google.com>
+Hector Oswaldo Caballero <hector.caballero@ericsson.com> Hector Caballero <hector.caballero@ericsson.com>
+Lars Vogel <Lars.Vogel@vogella.com> Lars Vogel <Lars.Vogel@gmail.com>
+Mark Ingram <markdingram@gmail.com> markdingram <markdingram@gmail.com>
+Markus Duft <markus.duft@ssi-schaefer.com> Markus Duft <markus.duft@salomon.at>
+Michael Keppler <michael.keppler@gmx.de> Michael Keppler <Michael.Keppler@gmx.de>
+Roberto Tyley <roberto.tyley@guardian.co.uk> roberto <roberto.tyley@guardian.co.uk>
+Saša Živkov <sasa.zivkov@sap.com> Sasa Zivkov <sasa.zivkov@sap.com>
+Saša Živkov <sasa.zivkov@sap.com> Saša Živkov <zivkov@gmail.com>
+Saša Živkov <sasa.zivkov@sap.com> Sasa Zivkov <zivkov@gmail.com>
+Shawn Pearce <spearce@spearce.org> Shawn O. Pearce <sop@google.com>
+Shawn Pearce <spearce@spearce.org> Shawn Pearce <sop@google.com>
+Shawn Pearce <spearce@spearce.org> Shawn O. Pearce <spearce@spearce.org>
+Terry Parker <tparker@google.com> tparker <tparker@google.com>
diff --git a/WORKSPACE b/WORKSPACE
index 9d723d2..209550f 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,5 +1,18 @@
workspace(name = "jgit")
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "bazel_skylib",
+ sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
+ strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
+ urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
+)
+
+load("@bazel_skylib//:lib.bzl", "versions")
+
+versions.check(minimum_bazel_version = "0.17.1")
+
load("//tools:bazlets.bzl", "load_bazlets")
load_bazlets(commit = "3afbeab55ece585dbfc7a980bf7214b24ddbbe86")
diff --git a/lib/BUILD b/lib/BUILD
index ebba0da..7cd420a 100644
--- a/lib/BUILD
+++ b/lib/BUILD
@@ -23,7 +23,6 @@
java_library(
name = "commons-logging",
- testonly = 1,
visibility = ["//visibility:public"],
exports = ["@commons-logging//jar"],
)
diff --git a/org.eclipse.jgit.ant.test/.classpath b/org.eclipse.jgit.ant.test/.classpath
index eca7bdb..3e5654f 100644
--- a/org.eclipse.jgit.ant.test/.classpath
+++ b/org.eclipse.jgit.ant.test/.classpath
@@ -2,6 +2,10 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.ant.test/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.ant.test/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.ant.test/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.ant.test/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF
index eed03d7..e6bef69 100644
--- a/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF
@@ -4,13 +4,13 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.ant.test
Bundle-SymbolicName: org.eclipse.jgit.ant.test
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.tools.ant,
- org.eclipse.jgit.ant.tasks;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.ant.tasks;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)"
diff --git a/org.eclipse.jgit.ant.test/pom.xml b/org.eclipse.jgit.ant.test/pom.xml
index 26bd15b..9526daf 100644
--- a/org.eclipse.jgit.ant.test/pom.xml
+++ b/org.eclipse.jgit.ant.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ant.test</artifactId>
diff --git a/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
index 565b75c..94a1c4f 100644
--- a/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.ant/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.ant/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.ant/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.ant/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.ant/META-INF/MANIFEST.MF b/org.eclipse.jgit.ant/META-INF/MANIFEST.MF
index 5778a05..d151b32 100644
--- a/org.eclipse.jgit.ant/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ant/META-INF/MANIFEST.MF
@@ -3,11 +3,11 @@
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.ant
Bundle-SymbolicName: org.eclipse.jgit.ant
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.tools.ant,
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)"
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)"
Bundle-Localization: plugin
Bundle-Vendor: %Provider-Name
-Export-Package: org.eclipse.jgit.ant.tasks;version="5.1.4";
+Export-Package: org.eclipse.jgit.ant.tasks;version="5.2.0";
uses:="org.apache.tools.ant.types,org.apache.tools.ant"
diff --git a/org.eclipse.jgit.ant/pom.xml b/org.eclipse.jgit.ant/pom.xml
index 013d69e..445a2f5 100644
--- a/org.eclipse.jgit.ant/pom.xml
+++ b/org.eclipse.jgit.ant/pom.xml
@@ -48,7 +48,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ant</artifactId>
diff --git a/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
index 13c32a6..ef6f5e7 100644
--- a/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.archive/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.archive/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.archive/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.archive/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.archive/META-INF/MANIFEST.MF b/org.eclipse.jgit.archive/META-INF/MANIFEST.MF
index f8bf17e..31875bb 100644
--- a/org.eclipse.jgit.archive/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.archive/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.archive
Bundle-SymbolicName: org.eclipse.jgit.archive
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -13,15 +13,15 @@
org.apache.commons.compress.compressors.bzip2;version="[1.4,2.0)",
org.apache.commons.compress.compressors.gzip;version="[1.4,2.0)",
org.apache.commons.compress.compressors.xz;version="[1.4,2.0)",
- org.eclipse.jgit.api;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.api;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
org.osgi.framework;version="[1.3.0,2.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.jgit.archive.FormatActivator
-Export-Package: org.eclipse.jgit.archive;version="5.1.4";
+Export-Package: org.eclipse.jgit.archive;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.api,
org.apache.commons.compress.archivers,
diff --git a/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF
index 7e7547e..7556798 100644
--- a/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@
Bundle-Name: org.eclipse.jgit.archive - Sources
Bundle-SymbolicName: org.eclipse.jgit.archive.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.1.4.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.archive;version="5.1.4.qualifier";roots="."
+Bundle-Version: 5.2.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.archive;version="5.2.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.archive/pom.xml b/org.eclipse.jgit.archive/pom.xml
index e8ce6f8..b374dbd 100644
--- a/org.eclipse.jgit.archive/pom.xml
+++ b/org.eclipse.jgit.archive/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.archive</artifactId>
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
index 9ed60d9..aee80d8 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
@@ -42,7 +42,7 @@
*/
package org.eclipse.jgit.archive;
-import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
+import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.IOException;
import java.io.OutputStream;
@@ -85,7 +85,7 @@ public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
Map<String, Object> o) throws IOException {
TarArchiveOutputStream out = new TarArchiveOutputStream(s,
- CHARACTER_ENCODING);
+ UTF_8.name());
out.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
out.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
return applyFormatOptions(out, o);
@@ -99,8 +99,7 @@ public void putEntry(ArchiveOutputStream out,
if (mode == FileMode.SYMLINK) {
final TarArchiveEntry entry = new TarArchiveEntry(
path, TarConstants.LF_SYMLINK);
- entry.setLinkName(new String(
- loader.getCachedBytes(100), CHARACTER_ENCODING));
+ entry.setLinkName(new String(loader.getCachedBytes(100), UTF_8));
out.putArchiveEntry(entry);
out.closeArchiveEntry();
return;
diff --git a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
index 565b75c..94a1c4f 100644
--- a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.http.apache/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.http.apache/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.http.apache/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.http.apache/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF
index 750f71c..1e8842b 100644
--- a/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.http.apache
Bundle-SymbolicName: org.eclipse.jgit.http.apache
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin
Bundle-Vendor: %Provider-Name
@@ -23,10 +23,10 @@
org.apache.http.impl.client;version="[4.3.0,5.0.0)",
org.apache.http.impl.conn;version="[4.3.0,5.0.0)",
org.apache.http.params;version="[4.3.0,5.0.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)"
-Export-Package: org.eclipse.jgit.transport.http.apache;version="5.1.4";
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)"
+Export-Package: org.eclipse.jgit.transport.http.apache;version="5.2.0";
uses:="org.apache.http.client,
org.eclipse.jgit.transport.http,
org.apache.http.entity,
diff --git a/org.eclipse.jgit.http.apache/pom.xml b/org.eclipse.jgit.http.apache/pom.xml
index bc2297c..8aea887 100644
--- a/org.eclipse.jgit.http.apache/pom.xml
+++ b/org.eclipse.jgit.http.apache/pom.xml
@@ -48,7 +48,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.http.apache</artifactId>
diff --git a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
index 565b75c..94a1c4f 100644
--- a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.http.server/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.http.server/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.http.server/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.http.server/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
index 4520ed7..c85e496 100644
--- a/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
@@ -3,13 +3,13 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.http.server
Bundle-SymbolicName: org.eclipse.jgit.http.server
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
-Export-Package: org.eclipse.jgit.http.server;version="5.1.4",
- org.eclipse.jgit.http.server.glue;version="5.1.4";
+Export-Package: org.eclipse.jgit.http.server;version="5.2.0",
+ org.eclipse.jgit.http.server.glue;version="5.2.0";
uses:="javax.servlet,javax.servlet.http",
- org.eclipse.jgit.http.server.resolver;version="5.1.4";
+ org.eclipse.jgit.http.server.resolver;version="5.2.0";
uses:="org.eclipse.jgit.transport.resolver,
org.eclipse.jgit.lib,
org.eclipse.jgit.transport,
@@ -18,12 +18,13 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: javax.servlet;version="[2.5.0,3.2.0)",
javax.servlet.http;version="[2.5.0,3.2.0)",
- org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.resolver;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)"
+ org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.transport.parser;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)"
diff --git a/org.eclipse.jgit.http.server/pom.xml b/org.eclipse.jgit.http.server/pom.xml
index be409e0..a5c1a1c 100644
--- a/org.eclipse.jgit.http.server/pom.xml
+++ b/org.eclipse.jgit.http.server/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.http.server</artifactId>
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
index b9ca12b..ee4b32e 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitSmartHttpTools.java
@@ -63,6 +63,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.eclipse.jgit.internal.transport.parser.FirstWant;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.transport.PacketLineIn;
import org.eclipse.jgit.transport.PacketLineOut;
@@ -246,9 +247,9 @@ private static boolean isUploadPackSideBand(HttpServletRequest req) {
// not have an UploadPack, or it might not have read any of the request.
// So, cheat and read the first line.
String line = new PacketLineIn(req.getInputStream()).readString();
- UploadPack.FirstLine parsed = new UploadPack.FirstLine(line);
- return (parsed.getOptions().contains(OPTION_SIDE_BAND)
- || parsed.getOptions().contains(OPTION_SIDE_BAND_64K));
+ FirstWant parsed = FirstWant.fromLine(line);
+ return (parsed.getCapabilities().contains(OPTION_SIDE_BAND)
+ || parsed.getCapabilities().contains(OPTION_SIDE_BAND_64K));
} catch (IOException e) {
// Probably the connection is closed and a subsequent write will fail, but
// try it just in case.
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java
index 1a9d192..b084b0d 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java
@@ -69,7 +69,7 @@ public void doGet(final HttpServletRequest req,
// Assume a dumb client and send back the dumb client
// version of the info/refs file.
rsp.setContentType(HttpSupport.TEXT_PLAIN);
- rsp.setCharacterEncoding(Constants.CHARACTER_ENCODING);
+ rsp.setCharacterEncoding(UTF_8.name());
final Repository db = getRepository(req);
try (OutputStreamWriter out = new OutputStreamWriter(
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java
index 9601c8c..b6d73b5 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ServletUtils.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.http.server;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.util.HttpSupport.ENCODING_GZIP;
import static org.eclipse.jgit.util.HttpSupport.ENCODING_X_GZIP;
import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT_ENCODING;
@@ -191,9 +192,9 @@ public static void consumeRequestBody(InputStream in) {
public static void sendPlainText(final String content,
final HttpServletRequest req, final HttpServletResponse rsp)
throws IOException {
- final byte[] raw = content.getBytes(Constants.CHARACTER_ENCODING);
+ final byte[] raw = content.getBytes(UTF_8);
rsp.setContentType(TEXT_PLAIN);
- rsp.setCharacterEncoding(Constants.CHARACTER_ENCODING);
+ rsp.setCharacterEncoding(UTF_8.name());
send(raw, req, rsp);
}
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
index ad5e8d4..06bdce6 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
@@ -105,6 +105,7 @@ public void close() throws IOException {
// If output hasn't started yet, the entire thing fit into our
// buffer. Try to use a proper Content-Length header, and also
// deflate the response with gzip if it will be smaller.
+ @SuppressWarnings("resource")
TemporaryBuffer out = this;
if (256 < out.length() && acceptsGzipEncoding(req)) {
diff --git a/org.eclipse.jgit.http.test/.classpath b/org.eclipse.jgit.http.test/.classpath
index e6014c7..b258380 100644
--- a/org.eclipse.jgit.http.test/.classpath
+++ b/org.eclipse.jgit.http.test/.classpath
@@ -2,7 +2,15 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="tst"/>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="tst">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.http.test/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.http.test/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.http.test/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.http.test/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
index ac66b79..37a9549 100644
--- a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.http.test
Bundle-SymbolicName: org.eclipse.jgit.http.test
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -28,25 +28,25 @@
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.thread;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.http.server;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.http.server.glue;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.http.server.resolver;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.reftable;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit.http;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http.apache;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.resolver;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.http.server;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.http.server.glue;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.http.server.resolver;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.reftable;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit.http;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http.apache;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
org.hamcrest;version="[1.1.0,2.0.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
diff --git a/org.eclipse.jgit.http.test/pom.xml b/org.eclipse.jgit.http.test/pom.xml
index 23a08aa..5bc342c 100644
--- a/org.eclipse.jgit.http.test/pom.xml
+++ b/org.eclipse.jgit.http.test/pom.xml
@@ -51,7 +51,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.http.test</artifactId>
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
index 82e79b8..553c340 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java
@@ -147,6 +147,7 @@ public void testNotAGitRepository() throws IOException,
try {
resolver.open(null, name);
+ fail("opened non-git repository");
} catch (RepositoryNotFoundException e) {
assertEquals("repository not found: " + name, e.getMessage());
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/RegexPipelineTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/RegexPipelineTest.java
index 725a590..59c2b4e 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/RegexPipelineTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/RegexPipelineTest.java
@@ -43,11 +43,14 @@
package org.eclipse.jgit.http.test;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URI;
@@ -82,7 +85,8 @@ private Servlet(String name) {
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
res.setStatus(200);
- PrintWriter out = new PrintWriter(res.getOutputStream());
+ PrintWriter out = new PrintWriter(new BufferedWriter(
+ new OutputStreamWriter(res.getOutputStream(), UTF_8)));
out.write(name);
out.write("\n");
out.write(String.valueOf(req.getServletPath()));
@@ -120,7 +124,8 @@ public void testSimpleRegex() throws Exception {
c = ((HttpURLConnection) uri.resolve("/a").toURL()
.openConnection());
assertEquals(200, c.getResponseCode());
- r = new BufferedReader(new InputStreamReader(c.getInputStream()));
+ r = new BufferedReader(
+ new InputStreamReader(c.getInputStream(), UTF_8));
assertEquals("test", r.readLine());
assertEquals("", r.readLine());
assertEquals("/a", r.readLine());
@@ -129,7 +134,8 @@ public void testSimpleRegex() throws Exception {
c = ((HttpURLConnection) uri.resolve("/b").toURL()
.openConnection());
assertEquals(200, c.getResponseCode());
- r = new BufferedReader(new InputStreamReader(c.getInputStream()));
+ r = new BufferedReader(
+ new InputStreamReader(c.getInputStream(), UTF_8));
assertEquals("test", r.readLine());
assertEquals("", r.readLine());
assertEquals("/b", r.readLine());
@@ -155,7 +161,8 @@ public void testServeOrdering() throws Exception {
c = ((HttpURLConnection) uri.resolve("/a").toURL()
.openConnection());
assertEquals(200, c.getResponseCode());
- r = new BufferedReader(new InputStreamReader(c.getInputStream()));
+ r = new BufferedReader(
+ new InputStreamReader(c.getInputStream(), UTF_8));
assertEquals("test1", r.readLine());
assertEquals("", r.readLine());
assertEquals("/a", r.readLine());
@@ -183,7 +190,8 @@ public void testRegexGroupFilter() throws Exception {
c = ((HttpURLConnection) uri.resolve("/a/b").toURL()
.openConnection());
assertEquals(200, c.getResponseCode());
- r = new BufferedReader(new InputStreamReader(c.getInputStream()));
+ r = new BufferedReader(
+ new InputStreamReader(c.getInputStream(), UTF_8));
assertEquals("test1", r.readLine());
assertEquals("", r.readLine());
// No RegexGroupFilter defaults to first group.
@@ -193,7 +201,8 @@ public void testRegexGroupFilter() throws Exception {
c = ((HttpURLConnection) uri.resolve("/c/d").toURL()
.openConnection());
assertEquals(200, c.getResponseCode());
- r = new BufferedReader(new InputStreamReader(c.getInputStream()));
+ r = new BufferedReader(
+ new InputStreamReader(c.getInputStream(), UTF_8));
assertEquals("test2", r.readLine());
assertEquals("", r.readLine());
assertEquals("/c", r.readLine());
@@ -202,7 +211,8 @@ public void testRegexGroupFilter() throws Exception {
c = ((HttpURLConnection) uri.resolve("/e/f/g").toURL()
.openConnection());
assertEquals(200, c.getResponseCode());
- r = new BufferedReader(new InputStreamReader(c.getInputStream()));
+ r = new BufferedReader(
+ new InputStreamReader(c.getInputStream(), UTF_8));
assertEquals("test3", r.readLine());
assertEquals("/e/f", r.readLine());
assertEquals("/g", r.readLine());
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index 51aa5f2..d1c7737 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -266,7 +266,7 @@ public void doFilter(ServletRequest request,
throws IOException, ServletException {
final HttpServletResponse r = (HttpServletResponse) response;
r.setContentType("text/plain");
- r.setCharacterEncoding(Constants.CHARACTER_ENCODING);
+ r.setCharacterEncoding(UTF_8.name());
try (PrintWriter w = r.getWriter()) {
w.print("OK");
}
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/transport/http/apache/HttpClientConnectionTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/transport/http/apache/HttpClientConnectionTest.java
index 72c4921..8a0d59c 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/transport/http/apache/HttpClientConnectionTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/transport/http/apache/HttpClientConnectionTest.java
@@ -76,7 +76,7 @@ public void testGetHeaderFieldsAllowMultipleValues()
assertTrue(headerValues.contains("NTLM"));
}
- private class HttpResponseMock extends AbstractHttpMessage
+ private static class HttpResponseMock extends AbstractHttpMessage
implements HttpResponse {
@Override
public StatusLine getStatusLine() {
diff --git a/org.eclipse.jgit.junit.http/.classpath b/org.eclipse.jgit.junit.http/.classpath
index b862a29..3e5654f 100644
--- a/org.eclipse.jgit.junit.http/.classpath
+++ b/org.eclipse.jgit.junit.http/.classpath
@@ -1,7 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.junit.http/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.junit.http/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.junit.http/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.junit.http/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
index b4a0d46..a95385a 100644
--- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.junit.http
Bundle-SymbolicName: org.eclipse.jgit.junit.http
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
Bundle-ActivationPolicy: lazy
@@ -22,16 +22,16 @@
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.ssl;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.http.server;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.resolver;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.http.server;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.2.0,5.3.0)",
org.junit;version="[4.12,5.0.0)"
-Export-Package: org.eclipse.jgit.junit.http;version="5.1.4";
+Export-Package: org.eclipse.jgit.junit.http;version="5.2.0";
uses:="org.eclipse.jgit.transport,
org.eclipse.jgit.junit,
javax.servlet.http,
diff --git a/org.eclipse.jgit.junit.http/pom.xml b/org.eclipse.jgit.junit.http/pom.xml
index 9b5ed19..72ab8d3 100644
--- a/org.eclipse.jgit.junit.http/pom.xml
+++ b/org.eclipse.jgit.junit.http/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.junit.http</artifactId>
diff --git a/org.eclipse.jgit.junit/.classpath b/org.eclipse.jgit.junit/.classpath
index eca7bdb..3e5654f 100644
--- a/org.eclipse.jgit.junit/.classpath
+++ b/org.eclipse.jgit.junit/.classpath
@@ -2,6 +2,10 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jgit.junit/.settings/.api_filters b/org.eclipse.jgit.junit/.settings/.api_filters
deleted file mode 100644
index e5de787..0000000
--- a/org.eclipse.jgit.junit/.settings/.api_filters
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.jgit.junit" version="2">
- <resource path="src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java" type="org.eclipse.jgit.junit.LocalDiskRepositoryTestCase">
- <filter comment="Don't care about non-API in tests." id="643842064">
- <message_arguments>
- <message_argument value="FileRepository"/>
- <message_argument value="LocalDiskRepositoryTestCase"/>
- <message_argument value="createBareRepository()"/>
- </message_arguments>
- </filter>
- <filter comment="Don't care about non-API in tests." id="643842064">
- <message_arguments>
- <message_argument value="FileRepository"/>
- <message_argument value="LocalDiskRepositoryTestCase"/>
- <message_argument value="createRepository(boolean, boolean)"/>
- </message_arguments>
- </filter>
- <filter comment="Don't care about non-API in tests." id="643842064">
- <message_arguments>
- <message_argument value="FileRepository"/>
- <message_argument value="LocalDiskRepositoryTestCase"/>
- <message_argument value="createWorkRepository()"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/junit/RepositoryTestCase.java" type="org.eclipse.jgit.junit.RepositoryTestCase">
- <filter comment="Don't care about non-API in tests." id="627060751">
- <message_arguments>
- <message_argument value="FileRepository"/>
- <message_argument value="RepositoryTestCase"/>
- <message_argument value="db"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.junit/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.junit/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.junit/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF
index e171965..9721c42 100644
--- a/org.eclipse.jgit.junit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF
@@ -3,31 +3,31 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.junit
Bundle-SymbolicName: org.eclipse.jgit.junit
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.eclipse.jgit.api;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.api.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.dircache;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.pack;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.merge;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util.io;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util.time;version="[5.1.4,5.2.0)",
+Import-Package: org.eclipse.jgit.api;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.api.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.dircache;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.pack;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.merge;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util.io;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util.time;version="[5.2.0,5.3.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
org.junit.runner;version="[4.12,5.0.0)",
org.junit.runners.model;version="[4.12,5.0.0)"
-Export-Package: org.eclipse.jgit.junit;version="5.1.4";
+Export-Package: org.eclipse.jgit.junit;version="5.2.0";
uses:="org.eclipse.jgit.dircache,
org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
@@ -36,4 +36,4 @@
org.eclipse.jgit.util,
org.eclipse.jgit.storage.file,
org.eclipse.jgit.api",
- org.eclipse.jgit.junit.time;version="5.1.4"
+ org.eclipse.jgit.junit.time;version="5.2.0"
diff --git a/org.eclipse.jgit.junit/pom.xml b/org.eclipse.jgit.junit/pom.xml
index 50c1818..24e2c71 100644
--- a/org.eclipse.jgit.junit/pom.xml
+++ b/org.eclipse.jgit.junit/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.junit</artifactId>
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
index d3d7d68..8de386e 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
@@ -70,7 +70,7 @@
* Mock {@link org.eclipse.jgit.util.SystemReader} for tests.
*/
public class MockSystemReader extends SystemReader {
- private final class MockConfig extends FileBasedConfig {
+ private static final class MockConfig extends FileBasedConfig {
private MockConfig(File cfgLocation, FS fs) {
super(cfgLocation, fs);
}
diff --git a/org.eclipse.jgit.lfs.server.test/.classpath b/org.eclipse.jgit.lfs.server.test/.classpath
index 4f9f6bf..f08af0a 100644
--- a/org.eclipse.jgit.lfs.server.test/.classpath
+++ b/org.eclipse.jgit.lfs.server.test/.classpath
@@ -2,6 +2,10 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="tst"/>
+ <classpathentry kind="src" path="tst">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.mylyn.team.ui.prefs
index ce7a0f0..984263d 100644
--- a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,2 +1,2 @@
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF
index 8d6fe4c..8035403 100644
--- a/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.lfs.server.test
Bundle-SymbolicName: org.eclipse.jgit.lfs.server.test
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -28,24 +28,24 @@
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.thread;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.api;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.api.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit.http;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.server;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.server.fs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.test;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.api;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.api.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit.http;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.server;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.server.fs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.test;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
diff --git a/org.eclipse.jgit.lfs.server.test/pom.xml b/org.eclipse.jgit.lfs.server.test/pom.xml
index 06e144a..5210d4f 100644
--- a/org.eclipse.jgit.lfs.server.test/pom.xml
+++ b/org.eclipse.jgit.lfs.server.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs.server.test</artifactId>
diff --git a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/PushTest.java b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/PushTest.java
index b081a8e..4eb4a0d 100644
--- a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/PushTest.java
+++ b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/PushTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.lfs.server.fs;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.InputStream;
@@ -149,7 +150,7 @@ public void testPushSimple() throws Exception {
new String(IO
.readWholeStream(is,
(int) ldr.getSize())
- .array()));
+ .array(), UTF_8));
}
}
diff --git a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
index 89394ec..525ac67 100644
--- a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.mylyn.team.ui.prefs
index ce7a0f0..984263d 100644
--- a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,2 +1,2 @@
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
index d4b2c03..2b6771c 100644
--- a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
@@ -3,19 +3,19 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.lfs.server
Bundle-SymbolicName: org.eclipse.jgit.lfs.server
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
-Export-Package: org.eclipse.jgit.lfs.server;version="5.1.4";
+Export-Package: org.eclipse.jgit.lfs.server;version="5.2.0";
uses:="javax.servlet.http,
org.eclipse.jgit.lfs.lib",
- org.eclipse.jgit.lfs.server.fs;version="5.1.4";
+ org.eclipse.jgit.lfs.server.fs;version="5.2.0";
uses:="javax.servlet,
javax.servlet.http,
org.eclipse.jgit.lfs.server,
org.eclipse.jgit.lfs.lib",
- org.eclipse.jgit.lfs.server.internal;version="5.1.4";x-internal:=true,
- org.eclipse.jgit.lfs.server.s3;version="5.1.4";
+ org.eclipse.jgit.lfs.server.internal;version="5.2.0";x-internal:=true,
+ org.eclipse.jgit.lfs.server.s3;version="5.2.0";
uses:="org.eclipse.jgit.lfs.server,
org.eclipse.jgit.lfs.lib"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -25,15 +25,15 @@
javax.servlet.http;version="[3.1.0,4.0.0)",
org.apache.http;version="[4.3.0,5.0.0)",
org.apache.http.client;version="[4.3.0,5.0.0)",
- org.eclipse.jgit.annotations;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.internal;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http.apache;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.annotations;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.internal;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http.apache;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
org.slf4j;version="[1.7.0,2.0.0)"
diff --git a/org.eclipse.jgit.lfs.server/pom.xml b/org.eclipse.jgit.lfs.server/pom.xml
index ef4569f..6a708d5 100644
--- a/org.eclipse.jgit.lfs.server/pom.xml
+++ b/org.eclipse.jgit.lfs.server/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs.server</artifactId>
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
index cfa53af..4cb0277 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
@@ -82,7 +82,8 @@ public interface LargeFileRepository {
* @return Action for verifying the object, or {@code null} if the server
* doesn't support or require verification
*/
- public @Nullable Response.Action getVerifyAction(AnyLongObjectId id);
+ @Nullable
+ public Response.Action getVerifyAction(AnyLongObjectId id);
/**
* Get size of an object
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
index 55d9093..0a7c37c 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
@@ -99,7 +99,8 @@ public Action getUploadAction(AnyLongObjectId id, long size) {
/** {@inheritDoc} */
@Override
- public @Nullable Action getVerifyAction(AnyLongObjectId id) {
+ @Nullable
+ public Action getVerifyAction(AnyLongObjectId id) {
return null;
}
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
index b21c94e..7b76cec 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
@@ -411,7 +411,8 @@ private static String urlEncode(String url, boolean keepPathSlash) {
String stringToSign = stringToSign(SCHEME, ALGORITHM, dateTimeStamp,
scope, canonicalRequest);
- byte[] signature = (SCHEME + bucketConfig.getSecretKey()).getBytes();
+ byte[] signature = (SCHEME + bucketConfig.getSecretKey())
+ .getBytes(UTF_8);
signature = sign(dateStamp, signature);
signature = sign(bucketConfig.getRegion(), signature);
signature = sign(S3, signature);
diff --git a/org.eclipse.jgit.lfs.test/.classpath b/org.eclipse.jgit.lfs.test/.classpath
index e43ae76..e79b7c7 100644
--- a/org.eclipse.jgit.lfs.test/.classpath
+++ b/org.eclipse.jgit.lfs.test/.classpath
@@ -2,7 +2,15 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="tst"/>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="tst">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.lfs.test/.settings/org.eclipse.mylyn.team.ui.prefs
index ce7a0f0..984263d 100644
--- a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.lfs.test/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,2 +1,2 @@
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF
index 7d96ca2..19c9953 100644
--- a/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF
@@ -3,23 +3,23 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.lfs.test
Bundle-SymbolicName: org.eclipse.jgit.lfs.test
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.eclipse.jgit.internal.storage.dfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
+Import-Package: org.eclipse.jgit.internal.storage.dfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.runner;version="[4.12,5.0.0)",
org.junit.runners;version="[4.12,5.0.0)"
-Export-Package: org.eclipse.jgit.lfs.test;version="5.1.4";x-friends:="org.eclipse.jgit.lfs.server.test"
+Export-Package: org.eclipse.jgit.lfs.test;version="5.2.0";x-friends:="org.eclipse.jgit.lfs.server.test"
diff --git a/org.eclipse.jgit.lfs.test/pom.xml b/org.eclipse.jgit.lfs.test/pom.xml
index 732193f..c04f916 100644
--- a/org.eclipse.jgit.lfs.test/pom.xml
+++ b/org.eclipse.jgit.lfs.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs.test</artifactId>
diff --git a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
index a1283dd..146a25e 100644
--- a/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
+++ b/org.eclipse.jgit.lfs.test/tst/org/eclipse/jgit/lfs/lib/LFSPointerTest.java
@@ -43,7 +43,7 @@
package org.eclipse.jgit.lfs.lib;
-import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
@@ -66,7 +66,7 @@ public void testEncoding() throws IOException {
assertEquals(
"version https://git-lfs.github.com/spec/v1\noid sha256:"
+ s + "\nsize 4\n",
- baos.toString(CHARACTER_ENCODING));
+ baos.toString(UTF_8.name()));
}
}
}
diff --git a/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
index 89394ec..525ac67 100644
--- a/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.lfs/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.lfs/.settings/org.eclipse.mylyn.team.ui.prefs
index ce7a0f0..984263d 100644
--- a/org.eclipse.jgit.lfs/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.lfs/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,2 +1,2 @@
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF
index 2cf8e2f..f3ab7fc 100644
--- a/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF
@@ -3,33 +3,33 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.lfs
Bundle-SymbolicName: org.eclipse.jgit.lfs
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
-Export-Package: org.eclipse.jgit.lfs;version="5.1.4",
- org.eclipse.jgit.lfs.errors;version="5.1.4",
- org.eclipse.jgit.lfs.internal;version="5.1.4";x-friends:="org.eclipse.jgit.lfs.test,org.eclipse.jgit.lfs.server.fs,org.eclipse.jgit.lfs.server",
- org.eclipse.jgit.lfs.lib;version="5.1.4"
+Export-Package: org.eclipse.jgit.lfs;version="5.2.0",
+ org.eclipse.jgit.lfs.errors;version="5.2.0",
+ org.eclipse.jgit.lfs.internal;version="5.2.0";x-friends:="org.eclipse.jgit.lfs.test,org.eclipse.jgit.lfs.server.fs,org.eclipse.jgit.lfs.server",
+ org.eclipse.jgit.lfs.lib;version="5.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.google.gson;version="[2.8.2,3.0.0)",
com.google.gson.stream;version="[2.8.2,3.0.0)",
org.apache.http.impl.client;version="[4.2.6,5.0.0)",
org.apache.http.impl.conn;version="[4.2.6,5.0.0)",
- org.eclipse.jgit.annotations;version="[5.1.4,5.2.0)";resolution:=optional,
- org.eclipse.jgit.api.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.attributes;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.diff;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.hooks;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.pack;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util.io;version="[5.1.4,5.2.0)"
+ org.eclipse.jgit.annotations;version="[5.2.0,5.3.0)";resolution:=optional,
+ org.eclipse.jgit.api.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.attributes;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.diff;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.hooks;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.pack;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util.io;version="[5.2.0,5.3.0)"
diff --git a/org.eclipse.jgit.lfs/pom.xml b/org.eclipse.jgit.lfs/pom.xml
index b289a4f..f49b8b6 100644
--- a/org.eclipse.jgit.lfs/pom.xml
+++ b/org.eclipse.jgit.lfs/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs</artifactId>
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
index 415caa9..56e3a12 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
@@ -99,7 +99,8 @@ public LfsInputStream applyCleanFilter(Repository db, InputStream input,
}
@Override
- public @Nullable PrePushHook getPrePushHook(Repository repo,
+ @Nullable
+ public PrePushHook getPrePushHook(Repository repo,
PrintStream outputStream) {
if (isEnabled(repo)) {
return new LfsPrePushHook(repo, outputStream);
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
index fac87c1..7bacf49 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java
@@ -222,7 +222,10 @@ public static Collection<Path> downloadLfsResource(Lfs lfs, Repository db,
Integer.valueOf(responseCode)));
}
Path path = lfs.getMediaFile(ptr.getOid());
- path.getParent().toFile().mkdirs();
+ Path parent = path.getParent();
+ if (parent != null) {
+ parent.toFile().mkdirs();
+ }
try (InputStream contentIn = contentServerConn
.getInputStream()) {
long bytesCopied = Files.copy(contentIn, path);
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java
index 0762ac5..317d68a 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java
@@ -106,7 +106,8 @@ public AtomicObjectOutputStream(Path path) throws IOException {
* stream. May return {@code null} if called before closing this
* stream.
*/
- public @Nullable AnyLongObjectId getId() {
+ @Nullable
+ public AnyLongObjectId getId() {
return id;
}
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
index 955eca0..feb8b4a 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
@@ -227,7 +227,8 @@ private static Protocol.ExpiringAction getSshAuthentication(
* @throws IOException
* in case of any error.
*/
- public static @NonNull HttpConnection getLfsContentConnection(
+ @NonNull
+ public static HttpConnection getLfsContentConnection(
Repository repo, Protocol.Action action, String method)
throws IOException {
URL contentUrl = new URL(action.href);
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml
index 161604c..9343e36 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit"
label="%featureName"
- version="5.1.4.qualifier"
+ version="5.2.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml
index c74e22e..48e1a45 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml
index 1339610..10dc8a3 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.http.apache"
label="%featureName"
- version="5.1.4.qualifier"
+ version="5.2.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml
index c9350f2..b833f98 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml
index 4339e85..cae4dd9 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.junit"
label="%featureName"
- version="5.1.4.qualifier"
+ version="5.2.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml
index 9228ad7..ad32702 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml
index 6beb73e..692d48c 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.lfs"
label="%featureName"
- version="5.1.4.qualifier"
+ version="5.2.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml
index 8a98f4f..b88eba0 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml
index 523668f..bbf0c6f 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.pgm"
label="%featureName"
- version="5.1.4.qualifier"
+ version="5.2.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
@@ -31,8 +31,8 @@
version="0.0.0"/>
<requires>
- <import feature="org.eclipse.jgit" version="5.1.4" match="equivalent"/>
- <import feature="org.eclipse.jgit.lfs" version="5.1.4" match="equivalent"/>
+ <import feature="org.eclipse.jgit" version="5.2.0" match="equivalent"/>
+ <import feature="org.eclipse.jgit.lfs" version="5.2.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml
index e95dc4a..0854a57 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/feature.xml
index 7e572e0..a70e791 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.pgm.source"
label="%featureName"
- version="5.1.4.qualifier"
+ version="5.2.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/pom.xml
index cb40a79..1287d05 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.source.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml
index 4555c81..c5681bd 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.repository</artifactId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
index f8b919e..1581663 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.source"
label="%featureName"
- version="5.1.4.qualifier"
+ version="5.2.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml
index 0cdb2dd..82e055f 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
index 0734df9..ebe9a53 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
@@ -2,4 +2,4 @@
Bundle-ManifestVersion: 2
Bundle-Name: JGit Target Platform Bundle
Bundle-SymbolicName: org.eclipse.jgit.target
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml
index 31542a3..7e5755f 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml
@@ -49,7 +49,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.target</artifactId>
diff --git a/org.eclipse.jgit.packaging/pom.xml b/org.eclipse.jgit.packaging/pom.xml
index 8894712..4d04a35 100644
--- a/org.eclipse.jgit.packaging/pom.xml
+++ b/org.eclipse.jgit.packaging/pom.xml
@@ -53,7 +53,7 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JGit Tycho Parent</name>
diff --git a/org.eclipse.jgit.pgm.test/.classpath b/org.eclipse.jgit.pgm.test/.classpath
index b26f4c4..1334739 100644
--- a/org.eclipse.jgit.pgm.test/.classpath
+++ b/org.eclipse.jgit.pgm.test/.classpath
@@ -1,7 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="tst"/>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="tst">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
index 932e1da..f9e9984 100644
--- a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
@@ -3,28 +3,28 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.pgm.test
Bundle-SymbolicName: org.eclipse.jgit.pgm.test
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Vendor: %provider_name
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.eclipse.jgit.api;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.api.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.diff;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.dircache;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="5.1.4",
- org.eclipse.jgit.junit;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.merge;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.pgm;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.pgm.internal;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.pgm.opt;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util.io;version="[5.1.4,5.2.0)",
+Import-Package: org.eclipse.jgit.api;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.api.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.diff;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.dircache;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="5.2.0",
+ org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.merge;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.pgm;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.pgm.internal;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.pgm.opt;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util.io;version="[5.2.0,5.3.0)",
org.hamcrest.core;bundle-version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
diff --git a/org.eclipse.jgit.pgm.test/pom.xml b/org.eclipse.jgit.pgm.test/pom.xml
index aa50962..6c8ce35 100644
--- a/org.eclipse.jgit.pgm.test/pom.xml
+++ b/org.eclipse.jgit.pgm.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.pgm.test</artifactId>
diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java
index 81875f1..9ad22dd 100644
--- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java
+++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java
@@ -42,11 +42,13 @@
*/
package org.eclipse.jgit.pgm;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertNull;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
@@ -153,7 +155,8 @@ private void run(String commandLine) throws Exception {
@Override
PrintWriter createErrorWriter() {
- return new PrintWriter(result.err);
+ return new PrintWriter(new OutputStreamWriter(
+ result.err, UTF_8));
}
@Override
@@ -249,19 +252,19 @@ public static class Result {
}
public String outString() {
- return out.toString();
+ return new String(out.toByteArray(), UTF_8);
}
public List<String> outLines() {
- return IO.readLines(out.toString());
+ return IO.readLines(outString());
}
public String errString() {
- return err.toString();
+ return new String(err.toByteArray(), UTF_8);
}
public List<String> errLines() {
- return IO.readLines(err.toString());
+ return IO.readLines(errString());
}
}
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ProxyConfigTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ProxyConfigTest.java
index 40a223d..42530f3 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ProxyConfigTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ProxyConfigTest.java
@@ -37,6 +37,7 @@
*/
package org.eclipse.jgit.pgm;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
@@ -47,7 +48,6 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.jgit.lib.Constants;
import org.junit.Before;
import org.junit.Test;
@@ -204,7 +204,7 @@ private static String getOutput(Process p)
while ((length = inputStream.read(buffer)) != -1) {
result.write(buffer, 0, length);
}
- return result.toString(Constants.CHARACTER_ENCODING);
+ return result.toString(UTF_8.name());
}
}
}
diff --git a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
index 13c32a6..ef6f5e7 100644
--- a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.pgm/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.pgm/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.pgm/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.pgm/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.pgm/BUILD b/org.eclipse.jgit.pgm/BUILD
index ddc84be..abd8556 100644
--- a/org.eclipse.jgit.pgm/BUILD
+++ b/org.eclipse.jgit.pgm/BUILD
@@ -7,6 +7,7 @@
deps = [
":services",
"//lib:args4j",
+ "//lib:commons-logging",
"//lib:httpclient",
"//lib:httpcore",
"//lib:jetty-http",
diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
index 5279e5e..ecce3ba 100644
--- a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.pgm
Bundle-SymbolicName: org.eclipse.jgit.pgm
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Vendor: %provider_name
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
@@ -28,49 +28,49 @@
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.thread;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.api;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.api.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.archive;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.awtui;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.blame;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.diff;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.dircache;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.gitrepo;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.ketch;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.io;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.pack;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.reftable;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.reftree;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.server;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.server.fs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs.server.s3;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.merge;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.notes;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revplot;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.pack;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http.apache;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.resolver;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util.io;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.api;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.api.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.archive;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.awtui;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.blame;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.diff;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.dircache;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.gitrepo;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.ketch;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.io;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.pack;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.reftable;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.reftree;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.server;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.server.fs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs.server.s3;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.merge;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.notes;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revplot;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.pack;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http.apache;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util.io;version="[5.2.0,5.3.0)",
org.kohsuke.args4j;version="[2.33.0,3.0.0)",
org.kohsuke.args4j.spi;version="[2.33.0,3.0.0)"
-Export-Package: org.eclipse.jgit.console;version="5.1.4";
+Export-Package: org.eclipse.jgit.console;version="5.2.0";
uses:="org.eclipse.jgit.transport,
org.eclipse.jgit.util",
- org.eclipse.jgit.pgm;version="5.1.4";
+ org.eclipse.jgit.pgm;version="5.2.0";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.pgm.opt,
@@ -81,11 +81,11 @@
org.eclipse.jgit.treewalk,
javax.swing,
org.eclipse.jgit.transport",
- org.eclipse.jgit.pgm.debug;version="5.1.4";
+ org.eclipse.jgit.pgm.debug;version="5.2.0";
uses:="org.eclipse.jgit.util.io,
org.eclipse.jgit.pgm",
- org.eclipse.jgit.pgm.internal;version="5.1.4";x-friends:="org.eclipse.jgit.pgm.test,org.eclipse.jgit.test",
- org.eclipse.jgit.pgm.opt;version="5.1.4";
+ org.eclipse.jgit.pgm.internal;version="5.2.0";x-friends:="org.eclipse.jgit.pgm.test,org.eclipse.jgit.test",
+ org.eclipse.jgit.pgm.opt;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.kohsuke.args4j.spi,
diff --git a/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF
index de0d2af..c10ea77 100644
--- a/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@
Bundle-Name: org.eclipse.jgit.pgm - Sources
Bundle-SymbolicName: org.eclipse.jgit.pgm.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.1.4.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.pgm;version="5.1.4.qualifier";roots="."
+Bundle-Version: 5.2.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.pgm;version="5.2.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml
index 1579a42..b229a8f 100644
--- a/org.eclipse.jgit.pgm/pom.xml
+++ b/org.eclipse.jgit.pgm/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.pgm</artifactId>
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
index 7e5b545..66c84af 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
@@ -44,6 +44,9 @@
package org.eclipse.jgit.pgm;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_SECTION_I18N;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_LOG_OUTPUT_ENCODING;
import static org.eclipse.jgit.lib.Constants.R_HEADS;
import static org.eclipse.jgit.lib.Constants.R_REMOTES;
import static org.eclipse.jgit.lib.Constants.R_TAGS;
@@ -56,6 +59,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.nio.charset.Charset;
import java.text.MessageFormat;
import java.util.ResourceBundle;
@@ -168,6 +172,30 @@ public void initRaw(final Repository repository, final String gitDir,
}
/**
+ * Get the log output encoding specified in the repository's
+ * {@code i18n.logOutputEncoding} configuration.
+ *
+ * @param repository
+ * the repository.
+ * @return Charset corresponding to {@code i18n.logOutputEncoding}, or
+ * {@code UTF_8}.
+ */
+ private Charset getLogOutputEncodingCharset(Repository repository) {
+ if (repository != null) {
+ String logOutputEncoding = repository.getConfig().getString(
+ CONFIG_SECTION_I18N, null, CONFIG_KEY_LOG_OUTPUT_ENCODING);
+ if (logOutputEncoding != null) {
+ try {
+ return Charset.forName(logOutputEncoding);
+ } catch (IllegalArgumentException e) {
+ throw die(CLIText.get().cannotCreateOutputStream);
+ }
+ }
+ }
+ return UTF_8;
+ }
+
+ /**
* Initialize the command to work with a repository.
*
* @param repository
@@ -177,32 +205,18 @@ public void initRaw(final Repository repository, final String gitDir,
* {@code repository} is null.
*/
protected void init(Repository repository, String gitDir) {
- try {
- final String outputEncoding = repository != null ? repository
- .getConfig().getString("i18n", null, "logOutputEncoding") : null; //$NON-NLS-1$ //$NON-NLS-2$
- if (ins == null)
- ins = new FileInputStream(FileDescriptor.in);
- if (outs == null)
- outs = new FileOutputStream(FileDescriptor.out);
- if (errs == null)
- errs = new FileOutputStream(FileDescriptor.err);
- BufferedWriter outbufw;
- if (outputEncoding != null)
- outbufw = new BufferedWriter(new OutputStreamWriter(outs,
- outputEncoding));
- else
- outbufw = new BufferedWriter(new OutputStreamWriter(outs));
- outw = new ThrowingPrintWriter(outbufw);
- BufferedWriter errbufw;
- if (outputEncoding != null)
- errbufw = new BufferedWriter(new OutputStreamWriter(errs,
- outputEncoding));
- else
- errbufw = new BufferedWriter(new OutputStreamWriter(errs));
- errw = new ThrowingPrintWriter(errbufw);
- } catch (IOException e) {
- throw die(CLIText.get().cannotCreateOutputStream);
- }
+ Charset charset = getLogOutputEncodingCharset(repository);
+
+ if (ins == null)
+ ins = new FileInputStream(FileDescriptor.in);
+ if (outs == null)
+ outs = new FileOutputStream(FileDescriptor.out);
+ if (errs == null)
+ errs = new FileOutputStream(FileDescriptor.err);
+ outw = new ThrowingPrintWriter(new BufferedWriter(
+ new OutputStreamWriter(outs, charset)));
+ errw = new ThrowingPrintWriter(new BufferedWriter(
+ new OutputStreamWriter(errs, charset)));
if (repository != null && repository.getDirectory() != null) {
db = repository;
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
index bb51b50..300a01d 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
@@ -474,7 +474,7 @@ private static abstract class Fold {
}
/** Utility to help us identify unique lines in a file. */
- private class Line {
+ private static class Line {
private final RawText txt;
private final int pos;
diff --git a/org.eclipse.jgit.test/.classpath b/org.eclipse.jgit.test/.classpath
index 84b5052..3b0dd26 100644
--- a/org.eclipse.jgit.test/.classpath
+++ b/org.eclipse.jgit.test/.classpath
@@ -1,9 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="**/*.idx|**/*.pack" kind="src" path="tst"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="tst-rsrc"/>
- <classpathentry kind="src" path="exttst"/>
+ <classpathentry excluding="**/*.idx|**/*.pack" kind="src" path="tst">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="tst-rsrc">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="exttst">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
index 794592d..2ca78ff 100644
--- a/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.test/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.test/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.test/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.test/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.test/META-INF/MANIFEST.MF
index c2159bd..6df9e39 100644
--- a/org.eclipse.jgit.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.test/META-INF/MANIFEST.MF
@@ -3,58 +3,59 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.test
Bundle-SymbolicName: org.eclipse.jgit.test
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
com.jcraft.jsch;version="[0.1.54,0.2.0)",
- org.eclipse.jgit.api;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.api.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.attributes;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.awtui;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.blame;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.diff;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.dircache;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.events;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.fnmatch;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.gitrepo;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.hooks;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.ignore;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.ignore.internal;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.fsck;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.io;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.pack;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.reftable;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.internal.storage.reftree;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.junit;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lfs;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.merge;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.notes;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.patch;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.pgm;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.pgm.internal;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revplot;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.file;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.storage.pack;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.submodule;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.http;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport.resolver;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util.io;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util.sha1;version="[5.1.4,5.2.0)",
+ org.eclipse.jgit.api;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.api.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.attributes;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.awtui;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.blame;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.diff;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.dircache;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.events;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.fnmatch;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.gitrepo;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.hooks;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.ignore;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.ignore.internal;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.fsck;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.io;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.pack;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.reftable;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.storage.reftree;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.internal.transport.parser;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lfs;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.merge;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.notes;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.patch;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.pgm;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.pgm.internal;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revplot;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.file;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.storage.pack;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.submodule;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.http;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util.io;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util.sha1;version="[5.2.0,5.3.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.experimental.theories;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml
index 7a220d5..6aa34f5 100644
--- a/org.eclipse.jgit.test/pom.xml
+++ b/org.eclipse.jgit.test/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.test</artifactId>
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
index 911f659..16cec64 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
@@ -43,6 +43,7 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.util.FileUtils.RECURSIVE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -118,7 +119,7 @@ public void testAddNonExistingSingleFile() throws GitAPIException {
public void testAddExistingSingleFile() throws IOException, GitAPIException {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
@@ -489,7 +490,7 @@ public void testAddExistingSingleSmallFileWithNewLine() throws IOException,
GitAPIException {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("row1\r\nrow2");
}
@@ -519,7 +520,7 @@ public void testAddExistingSingleMediumSizeFileWithNewLine()
data.append("row1\r\nrow2");
}
String crData = data.toString();
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print(crData);
}
String lfData = data.toString().replaceAll("\r", "");
@@ -544,7 +545,7 @@ public void testAddExistingSingleBinaryFile() throws IOException,
GitAPIException {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("row1\r\nrow2\u0000");
}
@@ -570,7 +571,7 @@ public void testAddExistingSingleFileInSubDir() throws IOException,
FileUtils.mkdir(new File(db.getWorkTree(), "sub"));
File file = new File(db.getWorkTree(), "sub/a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
@@ -588,7 +589,7 @@ public void testAddExistingSingleFileTwice() throws IOException,
GitAPIException {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
@@ -597,7 +598,7 @@ public void testAddExistingSingleFileTwice() throws IOException,
dc.getEntry(0).getObjectId();
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("other content");
}
@@ -613,7 +614,7 @@ public void testAddExistingSingleFileTwice() throws IOException,
public void testAddExistingSingleFileTwiceWithCommit() throws Exception {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
@@ -624,7 +625,7 @@ public void testAddExistingSingleFileTwiceWithCommit() throws Exception {
git.commit().setMessage("commit a.txt").call();
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("other content");
}
@@ -640,7 +641,7 @@ public void testAddExistingSingleFileTwiceWithCommit() throws Exception {
public void testAddRemovedFile() throws Exception {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
@@ -663,7 +664,7 @@ public void testAddRemovedFile() throws Exception {
public void testAddRemovedCommittedFile() throws Exception {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
@@ -690,13 +691,13 @@ public void testAddWithConflicts() throws Exception {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
File file2 = new File(db.getWorkTree(), "b.txt");
FileUtils.createNewFile(file2);
- try (PrintWriter writer = new PrintWriter(file2)) {
+ try (PrintWriter writer = new PrintWriter(file2, UTF_8.name())) {
writer.print("content b");
}
@@ -707,12 +708,12 @@ public void testAddWithConflicts() throws Exception {
addEntryToBuilder("b.txt", file2, newObjectInserter, builder, 0);
addEntryToBuilder("a.txt", file, newObjectInserter, builder, 1);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("other content");
}
addEntryToBuilder("a.txt", file, newObjectInserter, builder, 3);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("our content");
}
addEntryToBuilder("a.txt", file, newObjectInserter, builder, 2)
@@ -743,13 +744,13 @@ public void testAddWithConflicts() throws Exception {
public void testAddTwoFiles() throws Exception {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
File file2 = new File(db.getWorkTree(), "b.txt");
FileUtils.createNewFile(file2);
- try (PrintWriter writer = new PrintWriter(file2)) {
+ try (PrintWriter writer = new PrintWriter(file2, UTF_8.name())) {
writer.print("content b");
}
@@ -767,13 +768,13 @@ public void testAddFolder() throws Exception {
FileUtils.mkdir(new File(db.getWorkTree(), "sub"));
File file = new File(db.getWorkTree(), "sub/a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
File file2 = new File(db.getWorkTree(), "sub/b.txt");
FileUtils.createNewFile(file2);
- try (PrintWriter writer = new PrintWriter(file2)) {
+ try (PrintWriter writer = new PrintWriter(file2, UTF_8.name())) {
writer.print("content b");
}
@@ -791,19 +792,19 @@ public void testAddIgnoredFile() throws Exception {
FileUtils.mkdir(new File(db.getWorkTree(), "sub"));
File file = new File(db.getWorkTree(), "sub/a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
File ignoreFile = new File(db.getWorkTree(), ".gitignore");
FileUtils.createNewFile(ignoreFile);
- try (PrintWriter writer = new PrintWriter(ignoreFile)) {
+ try (PrintWriter writer = new PrintWriter(ignoreFile, UTF_8.name())) {
writer.print("sub/b.txt");
}
File file2 = new File(db.getWorkTree(), "sub/b.txt");
FileUtils.createNewFile(file2);
- try (PrintWriter writer = new PrintWriter(file2)) {
+ try (PrintWriter writer = new PrintWriter(file2, UTF_8.name())) {
writer.print("content b");
}
@@ -821,13 +822,13 @@ public void testAddWholeRepo() throws Exception {
FileUtils.mkdir(new File(db.getWorkTree(), "sub"));
File file = new File(db.getWorkTree(), "sub/a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
File file2 = new File(db.getWorkTree(), "sub/b.txt");
FileUtils.createNewFile(file2);
- try (PrintWriter writer = new PrintWriter(file2)) {
+ try (PrintWriter writer = new PrintWriter(file2, UTF_8.name())) {
writer.print("content b");
}
@@ -849,13 +850,13 @@ public void testAddWithoutParameterUpdate() throws Exception {
FileUtils.mkdir(new File(db.getWorkTree(), "sub"));
File file = new File(db.getWorkTree(), "sub/a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
File file2 = new File(db.getWorkTree(), "sub/b.txt");
FileUtils.createNewFile(file2);
- try (PrintWriter writer = new PrintWriter(file2)) {
+ try (PrintWriter writer = new PrintWriter(file2, UTF_8.name())) {
writer.print("content b");
}
@@ -872,12 +873,12 @@ public void testAddWithoutParameterUpdate() throws Exception {
// new unstaged file sub/c.txt
File file3 = new File(db.getWorkTree(), "sub/c.txt");
FileUtils.createNewFile(file3);
- try (PrintWriter writer = new PrintWriter(file3)) {
+ try (PrintWriter writer = new PrintWriter(file3, UTF_8.name())) {
writer.print("content c");
}
// file sub/a.txt is modified
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("modified content");
}
@@ -904,13 +905,13 @@ public void testAddWithParameterUpdate() throws Exception {
FileUtils.mkdir(new File(db.getWorkTree(), "sub"));
File file = new File(db.getWorkTree(), "sub/a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
File file2 = new File(db.getWorkTree(), "sub/b.txt");
FileUtils.createNewFile(file2);
- try (PrintWriter writer = new PrintWriter(file2)) {
+ try (PrintWriter writer = new PrintWriter(file2, UTF_8.name())) {
writer.print("content b");
}
@@ -927,12 +928,12 @@ public void testAddWithParameterUpdate() throws Exception {
// new unstaged file sub/c.txt
File file3 = new File(db.getWorkTree(), "sub/c.txt");
FileUtils.createNewFile(file3);
- try (PrintWriter writer = new PrintWriter(file3)) {
+ try (PrintWriter writer = new PrintWriter(file3, UTF_8.name())) {
writer.print("content c");
}
// file sub/a.txt is modified
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("modified content");
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
index 1300f98..1c41018 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -190,7 +191,8 @@ public void archiveByDirectoryPath() throws GitAPIException, IOException {
}
}
- private class MockFormat implements ArchiveCommand.Format<MockOutputStream> {
+ private static class MockFormat
+ implements ArchiveCommand.Format<MockOutputStream> {
private Map<String, String> entries = new HashMap<>();
@@ -230,7 +232,9 @@ public MockOutputStream createArchiveOutputStream(OutputStream s,
@Override
public void putEntry(MockOutputStream out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) {
- String content = mode != FileMode.TREE ? new String(loader.getBytes()) : null;
+ String content = mode != FileMode.TREE
+ ? new String(loader.getBytes(), UTF_8)
+ : null;
entries.put(path, content);
}
@@ -240,7 +244,7 @@ public Iterable<String> suffixes() {
}
}
- public class MockOutputStream extends OutputStream {
+ public static class MockOutputStream extends OutputStream {
private int foo;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
index 0d7009d..6b5fe50 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
@@ -370,8 +370,7 @@ public void testCloneRepositoryWithTagName() throws Exception {
}
@Test
- public void testCloneRepositoryOnlyOneBranch() throws IOException,
- JGitInternalException, GitAPIException {
+ public void testCloneRepositoryOnlyOneBranch() throws Exception {
File directory = createTempDirectory("testCloneRepositoryWithBranch");
CloneCommand command = Git.cloneRepository();
command.setBranch("refs/heads/master");
@@ -382,25 +381,47 @@ public void testCloneRepositoryOnlyOneBranch() throws IOException,
Git git2 = command.call();
addRepoToClose(git2.getRepository());
assertNotNull(git2);
+ assertNull(git2.getRepository().resolve("tag-for-blob"));
+ assertNotNull(git2.getRepository().resolve("tag-initial"));
assertEquals(git2.getRepository().getFullBranch(), "refs/heads/master");
assertEquals("refs/remotes/origin/master", allRefNames(git2
.branchList().setListMode(ListMode.REMOTE).call()));
+ RemoteConfig cfg = new RemoteConfig(git2.getRepository().getConfig(),
+ Constants.DEFAULT_REMOTE_NAME);
+ List<RefSpec> specs = cfg.getFetchRefSpecs();
+ assertEquals(1, specs.size());
+ assertEquals(
+ new RefSpec("+refs/heads/master:refs/remotes/origin/master"),
+ specs.get(0));
+ }
+ @Test
+ public void testBareCloneRepositoryOnlyOneBranch() throws Exception {
// Same thing, but now test with bare repo
- directory = createTempDirectory("testCloneRepositoryWithBranch_bare");
- command = Git.cloneRepository();
+ File directory = createTempDirectory(
+ "testCloneRepositoryWithBranch_bare");
+ CloneCommand command = Git.cloneRepository();
command.setBranch("refs/heads/master");
command.setBranchesToClone(Collections
.singletonList("refs/heads/master"));
command.setDirectory(directory);
command.setURI(fileUri());
command.setBare(true);
- git2 = command.call();
+ Git git2 = command.call();
addRepoToClose(git2.getRepository());
assertNotNull(git2);
+ assertNull(git2.getRepository().resolve("tag-for-blob"));
+ assertNotNull(git2.getRepository().resolve("tag-initial"));
assertEquals(git2.getRepository().getFullBranch(), "refs/heads/master");
assertEquals("refs/heads/master", allRefNames(git2.branchList()
.setListMode(ListMode.ALL).call()));
+ RemoteConfig cfg = new RemoteConfig(git2.getRepository().getConfig(),
+ Constants.DEFAULT_REMOTE_NAME);
+ List<RefSpec> specs = cfg.getFetchRefSpecs();
+ assertEquals(1, specs.size());
+ assertEquals(
+ new RefSpec("+refs/heads/master:refs/heads/master"),
+ specs.get(0));
}
public static String allRefNames(List<Ref> refs) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTest.java
index ca0630e..c028ca3 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -120,7 +121,7 @@ public void testLogWithFilter() throws IOException, JGitInternalException,
// create first file
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content1");
}
@@ -131,7 +132,7 @@ public void testLogWithFilter() throws IOException, JGitInternalException,
// create second file
file = new File(db.getWorkTree(), "b.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content2");
}
@@ -231,7 +232,7 @@ public void testAddUnstagedChanges() throws IOException,
JGitInternalException, GitAPIException {
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content");
}
@@ -242,7 +243,7 @@ public void testAddUnstagedChanges() throws IOException,
assertEquals("6b584e8ece562ebffc15d38808cd6b98fc3d97ea",
tw.getObjectId(0).getName());
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content2");
}
commit = git.commit().setMessage("second commit").call();
@@ -265,7 +266,7 @@ public void testModeChange() throws IOException, GitAPIException {
// create file
File file = new File(db.getWorkTree(), "a.txt");
FileUtils.createNewFile(file);
- try (PrintWriter writer = new PrintWriter(file)) {
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
writer.print("content1");
}
@@ -358,7 +359,7 @@ public void testInsertChangeId() throws JGitInternalException,
messageHeader + messageFooter)
.setInsertChangeId(true).call();
// we should find a real change id (at the end of the file)
- byte[] chars = commit.getFullMessage().getBytes();
+ byte[] chars = commit.getFullMessage().getBytes(UTF_8);
int lastLineBegin = RawParseUtils.prevLF(chars, chars.length - 2);
String lastLine = RawParseUtils.decode(chars, lastLineBegin + 1,
chars.length);
@@ -371,7 +372,7 @@ public void testInsertChangeId() throws JGitInternalException,
.setInsertChangeId(true).call();
// we should find a real change id (in the line as dictated by the
// template)
- chars = commit.getFullMessage().getBytes();
+ chars = commit.getFullMessage().getBytes(UTF_8);
int lineStart = 0;
int lineEnd = 0;
for (int i = 0; i < 4; i++) {
@@ -389,7 +390,7 @@ public void testInsertChangeId() throws JGitInternalException,
messageHeader + changeIdTemplate + messageFooter)
.setInsertChangeId(false).call();
// we should find the untouched template
- chars = commit.getFullMessage().getBytes();
+ chars = commit.getFullMessage().getBytes(UTF_8);
lineStart = 0;
lineEnd = 0;
for (int i = 0; i < 4; i++) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
index bbd6ec0..83181ee 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java
@@ -43,6 +43,7 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -1298,7 +1299,7 @@ static private String getHead(Git git, String path)
final TreeWalk tw = TreeWalk.forPath(repo, path,
rw.parseTree(headId));
return new String(tw.getObjectReader().open(tw.getObjectId(0))
- .getBytes());
+ .getBytes(), UTF_8);
}
} catch (Exception e) {
return "";
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CrLfNativeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CrLfNativeTest.java
new file mode 100644
index 0000000..c726128
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CrLfNativeTest.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2018, Thomas Wolf <thomas.wolf@paranor.ch>
+ * 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.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jgit.api.ResetCommand.ResetType;
+import org.eclipse.jgit.junit.MockSystemReader;
+import org.eclipse.jgit.junit.RepositoryTestCase;
+import org.eclipse.jgit.lib.CoreConfig.EolStreamType;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.treewalk.FileTreeIterator;
+import org.eclipse.jgit.treewalk.TreeWalk;
+import org.eclipse.jgit.treewalk.TreeWalk.OperationType;
+import org.eclipse.jgit.util.SystemReader;
+import org.junit.Test;
+
+public class CrLfNativeTest extends RepositoryTestCase {
+
+ @Test
+ public void checkoutWithCrLfNativeUnix() throws Exception {
+ verifyNativeCheckout(new MockSystemReader() {
+ {
+ setUnix();
+ }
+ });
+ }
+
+ @Test
+ public void checkoutWithCrLfNativeWindows() throws Exception {
+ verifyNativeCheckout(new MockSystemReader() {
+ {
+ setWindows();
+ }
+ });
+ }
+
+ private void verifyNativeCheckout(SystemReader systemReader)
+ throws Exception {
+ SystemReader.setInstance(systemReader);
+ Git git = Git.wrap(db);
+ FileBasedConfig config = db.getConfig();
+ config.setString("core", null, "autocrlf", "false");
+ config.setString("core", null, "eol", "native");
+ config.save();
+ // core.eol is active only if text is set, or if text=auto
+ writeTrashFile(".gitattributes", "*.txt text\n");
+ File file = writeTrashFile("file.txt", "line 1\nline 2\n");
+ git.add().addFilepattern("file.txt").addFilepattern(".gitattributes")
+ .call();
+ git.commit().setMessage("Initial").call();
+ // Check-in with core.eol=native normalization
+ assertEquals(
+ "[.gitattributes, mode:100644, content:*.txt text\n]"
+ + "[file.txt, mode:100644, content:line 1\nline 2\n]",
+ indexState(CONTENT));
+ writeTrashFile("file.txt", "something else");
+ git.add().addFilepattern("file.txt").call();
+ git.commit().setMessage("New commit").call();
+ git.reset().setMode(ResetType.HARD).setRef("HEAD~").call();
+ // Check-out should convert to the native line separator
+ checkFile(file, systemReader.isWindows() ? "line 1\r\nline 2\r\n"
+ : "line 1\nline 2\n");
+ Status status = git.status().call();
+ assertTrue("git status should be clean", status.isClean());
+ }
+
+ /**
+ * Verifies the handling of the crlf attribute: crlf == text, -crlf ==
+ * -text, crlf=input == eol=lf
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCrLfAttribute() throws Exception {
+ FileBasedConfig config = db.getConfig();
+ config.setString("core", null, "autocrlf", "false");
+ config.setString("core", null, "eol", "crlf");
+ config.save();
+ writeTrashFile(".gitattributes",
+ "*.txt text\n*.crlf crlf\n*.bin -text\n*.nocrlf -crlf\n*.input crlf=input\n*.eol eol=lf");
+ writeTrashFile("foo.txt", "");
+ writeTrashFile("foo.crlf", "");
+ writeTrashFile("foo.bin", "");
+ writeTrashFile("foo.nocrlf", "");
+ writeTrashFile("foo.input", "");
+ writeTrashFile("foo.eol", "");
+ Map<String, EolStreamType> inTypes = new HashMap<>();
+ Map<String, EolStreamType> outTypes = new HashMap<>();
+ try (TreeWalk walk = new TreeWalk(db)) {
+ walk.addTree(new FileTreeIterator(db));
+ while (walk.next()) {
+ String path = walk.getPathString();
+ if (".gitattributes".equals(path)) {
+ continue;
+ }
+ EolStreamType in = walk
+ .getEolStreamType(OperationType.CHECKIN_OP);
+ EolStreamType out = walk
+ .getEolStreamType(OperationType.CHECKOUT_OP);
+ inTypes.put(path, in);
+ outTypes.put(path, out);
+ }
+ }
+ assertEquals("", checkTypes("check-in", inTypes));
+ assertEquals("", checkTypes("check-out", outTypes));
+ }
+
+ private String checkTypes(String prefix, Map<String, EolStreamType> types) {
+ StringBuilder result = new StringBuilder();
+ EolStreamType a = types.get("foo.crlf");
+ EolStreamType b = types.get("foo.txt");
+ report(result, prefix, "crlf != text", a, b);
+ a = types.get("foo.nocrlf");
+ b = types.get("foo.bin");
+ report(result, prefix, "-crlf != -text", a, b);
+ a = types.get("foo.input");
+ b = types.get("foo.eol");
+ report(result, prefix, "crlf=input != eol=lf", a, b);
+ return result.toString();
+ }
+
+ private void report(StringBuilder result, String prefix, String label,
+ EolStreamType a,
+ EolStreamType b) {
+ if (a == null || b == null || !a.equals(b)) {
+ result.append(prefix).append(' ').append(label).append(": ")
+ .append(toString(a)).append(" != ").append(toString(b))
+ .append('\n');
+ }
+ }
+
+ private String toString(EolStreamType type) {
+ return type == null ? "null" : type.name();
+ }
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java
index a422ef9..bb0714d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DescribeCommandTest.java
@@ -42,13 +42,15 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.Arrays;
import java.util.Collection;
@@ -404,7 +406,7 @@ private void tag(String tag, boolean annotatedTag) throws GitAPIException {
}
private static void touch(File f, String contents) throws Exception {
- try (FileWriter w = new FileWriter(f)) {
+ try (BufferedWriter w = Files.newBufferedWriter(f.toPath(), UTF_8)) {
w.write(contents);
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java
index 48d3733..47806cb 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java
@@ -38,6 +38,7 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -722,10 +723,10 @@ private void collectEntryContentAndAttributes(FileMode type, String pathName,
}
e.attrs = e.attrs.trim();
e.file = new String(
- IO.readFully(new File(db.getWorkTree(), pathName)));
+ IO.readFully(new File(db.getWorkTree(), pathName)), UTF_8);
DirCacheEntry dce = dirCache.getEntry(pathName);
ObjectLoader open = walk.getObjectReader().open(dce.getObjectId());
- e.index = new String(open.getBytes());
+ e.index = new String(open.getBytes(), UTF_8);
e.indexContentLength = dce.getLength();
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
index 2b97b30..9b12011 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
@@ -82,6 +82,8 @@ public class ResetCommandTest extends RepositoryTestCase {
private File indexFile;
+ private File indexNestedFile;
+
private File untrackedFile;
private DirCacheEntry prestage;
@@ -97,7 +99,7 @@ public void setupRepository() throws IOException, JGitInternalException,
indexFile = writeTrashFile("a.txt", "content");
// create nested file
- writeTrashFile("dir/b.txt", "content");
+ indexNestedFile = writeTrashFile("dir/b.txt", "content");
// add files and commit them
git.add().addFilepattern("a.txt").addFilepattern("dir/b.txt").call();
@@ -119,13 +121,16 @@ public void testHardReset() throws JGitInternalException,
AmbiguousObjectException, IOException, GitAPIException {
setupRepository();
ObjectId prevHead = db.resolve(Constants.HEAD);
- assertSameAsHead(git.reset().setMode(ResetType.HARD)
+ ResetCommand reset = git.reset();
+ assertSameAsHead(reset.setMode(ResetType.HARD)
.setRef(initialCommit.getName()).call());
+ assertFalse("reflog should be enabled", reset.isReflogDisabled());
// check if HEAD points to initial commit now
ObjectId head = db.resolve(Constants.HEAD);
assertEquals(initialCommit, head);
// check if files were removed
assertFalse(indexFile.exists());
+ assertFalse(indexNestedFile.exists());
assertTrue(untrackedFile.exists());
// fileInIndex must no longer be in HEAD and in the index
String fileInIndexPath = indexFile.getAbsolutePath();
@@ -148,6 +153,7 @@ public void testHardResetReflogDisabled() throws Exception {
assertEquals(initialCommit, head);
// check if files were removed
assertFalse(indexFile.exists());
+ assertFalse(indexNestedFile.exists());
assertTrue(untrackedFile.exists());
// fileInIndex must no longer be in HEAD and in the index
String fileInIndexPath = indexFile.getAbsolutePath();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeTest.java
index f0d3c36..f4ccf05 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.attributes;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.attributes.Attribute.State.SET;
import static org.eclipse.jgit.attributes.Attribute.State.UNSET;
import static org.junit.Assert.assertEquals;
@@ -88,7 +89,7 @@ public void testBasic() throws IOException {
String attributeFileContent = "*.type1 A -B C=value\n"
+ "*.type2 -A B C=value2";
- is = new ByteArrayInputStream(attributeFileContent.getBytes());
+ is = new ByteArrayInputStream(attributeFileContent.getBytes(UTF_8));
AttributesNode node = new AttributesNode();
node.parse(is);
assertAttribute("file.type1", node,
@@ -102,7 +103,7 @@ public void testNegativePattern() throws IOException {
String attributeFileContent = "!*.type1 A -B C=value\n"
+ "!*.type2 -A B C=value2";
- is = new ByteArrayInputStream(attributeFileContent.getBytes());
+ is = new ByteArrayInputStream(attributeFileContent.getBytes(UTF_8));
AttributesNode node = new AttributesNode();
node.parse(is);
assertAttribute("file.type1", node, new Attributes());
@@ -113,7 +114,7 @@ public void testNegativePattern() throws IOException {
public void testEmptyNegativeAttributeKey() throws IOException {
String attributeFileContent = "*.type1 - \n" //
+ "*.type2 - -A";
- is = new ByteArrayInputStream(attributeFileContent.getBytes());
+ is = new ByteArrayInputStream(attributeFileContent.getBytes(UTF_8));
AttributesNode node = new AttributesNode();
node.parse(is);
assertAttribute("file.type1", node, new Attributes());
@@ -125,7 +126,7 @@ public void testEmptyValueKey() throws IOException {
String attributeFileContent = "*.type1 = \n" //
+ "*.type2 =value\n"//
+ "*.type3 attr=\n";
- is = new ByteArrayInputStream(attributeFileContent.getBytes());
+ is = new ByteArrayInputStream(attributeFileContent.getBytes(UTF_8));
AttributesNode node = new AttributesNode();
node.parse(is);
assertAttribute("file.type1", node, new Attributes());
@@ -140,7 +141,7 @@ public void testEmptyLine() throws IOException {
+ " \n" //
+ "*.type2 -A B C=value2";
- is = new ByteArrayInputStream(attributeFileContent.getBytes());
+ is = new ByteArrayInputStream(attributeFileContent.getBytes(UTF_8));
AttributesNode node = new AttributesNode();
node.parse(is);
assertAttribute("file.type1", node,
@@ -156,7 +157,7 @@ public void testTabSeparator() throws IOException {
+ "*.type3 \t\t B\n" //
+ "*.type3\t-A";//
- is = new ByteArrayInputStream(attributeFileContent.getBytes());
+ is = new ByteArrayInputStream(attributeFileContent.getBytes(UTF_8));
AttributesNode node = new AttributesNode();
node.parse(is);
assertAttribute("file.type1", node,
@@ -170,7 +171,7 @@ public void testTabSeparator() throws IOException {
public void testDoubleAsteriskAtEnd() throws IOException {
String attributeFileContent = "dir/** \tA -B\tC=value";
- is = new ByteArrayInputStream(attributeFileContent.getBytes());
+ is = new ByteArrayInputStream(attributeFileContent.getBytes(UTF_8));
AttributesNode node = new AttributesNode();
node.parse(is);
assertAttribute("dir", node,
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
index d12f302..b6291bf 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
@@ -89,6 +89,7 @@ public void testBuildRejectsUnsetFileMode() throws Exception {
assertEquals(0, e.getRawMode());
try {
b.add(e);
+ fail("did not reject unset file mode");
} catch (IllegalArgumentException err) {
assertEquals("FileMode not set for path a", err.getMessage());
}
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 92f0cf6..3b330ab 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
@@ -52,9 +52,9 @@
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
+import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
@@ -139,7 +139,7 @@ public void setUp() throws Exception {
resolveRelativeUris();
}
- class IndexedRepos implements RepoCommand.RemoteReader {
+ static class IndexedRepos implements RepoCommand.RemoteReader {
Map<String, Repository> uriRepoMap;
IndexedRepos() {
uriRepoMap = new HashMap<>();
@@ -474,8 +474,8 @@ public void testAddRepoManifest() throws Exception {
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
assertTrue("submodule should be checked out", hello.exists());
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("submodule content should be as expected",
"master world", content);
@@ -565,8 +565,8 @@ public void testRepoManifestCopyFile() throws Exception {
// The original file should exist
File hello = new File(localDb.getWorkTree(), "foo/hello.txt");
assertTrue("The original file should exist", hello.exists());
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("The original file should have expected content",
"master world", content);
@@ -574,8 +574,8 @@ public void testRepoManifestCopyFile() throws Exception {
// The dest file should also exist
hello = new File(localDb.getWorkTree(), "Hello");
assertTrue("The destination file should exist", hello.exists());
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("The destination file should have expected content",
"master world", content);
@@ -610,8 +610,8 @@ public void testBareRepo() throws Exception {
assertTrue("The .gitmodules file should exist",
gitmodules.exists());
// The first line of .gitmodules file should be expected
- try (BufferedReader reader = new BufferedReader(
- new FileReader(gitmodules))) {
+ try (BufferedReader reader = Files
+ .newBufferedReader(gitmodules.toPath(), UTF_8)) {
String content = reader.readLine();
assertEquals(
"The first line of .gitmodules file should be as expected",
@@ -644,8 +644,8 @@ public void testRevision() throws Exception {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("submodule content should be as expected",
"branch world", content);
@@ -671,8 +671,8 @@ public void testRevisionBranch() throws Exception {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("submodule content should be as expected",
"branch world", content);
@@ -698,8 +698,8 @@ public void testRevisionTag() throws Exception {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("submodule content should be as expected",
"branch world", content);
@@ -771,8 +771,8 @@ public void testCopyFileBare() throws Exception {
assertFalse("The foo/Hello file should be skipped",
foohello.exists());
// The content of Hello file should be expected
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("The Hello file should have expected content",
"branch world", content);
@@ -829,8 +829,8 @@ public void testReplaceManifestBare() throws Exception {
// The .gitmodules file should have 'submodule "bar"' and shouldn't
// have
// 'submodule "foo"' lines.
- try (BufferedReader reader = new BufferedReader(
- new FileReader(dotmodules))) {
+ try (BufferedReader reader = Files
+ .newBufferedReader(dotmodules.toPath(), UTF_8)) {
boolean foo = false;
boolean bar = false;
while (true) {
@@ -879,8 +879,8 @@ public void testRemoveOverlappingBare() throws Exception {
}
// Check .gitmodules file
- try (BufferedReader reader = new BufferedReader(
- new FileReader(dotmodules))) {
+ try (BufferedReader reader = Files
+ .newBufferedReader(dotmodules.toPath(), UTF_8)) {
boolean foo = false;
boolean foobar = false;
boolean a = false;
@@ -935,8 +935,8 @@ public void testIncludeTag() throws Exception {
.call();
File hello = new File(localDb.getWorkTree(), "foo/hello.txt");
assertTrue("submodule should be checked out", hello.exists());
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("submodule content should be as expected",
"master world", content);
@@ -1074,8 +1074,9 @@ public void testRecordSubmoduleLabels() throws Exception {
".gitattributes");
assertTrue("The .gitattributes file should exist",
gitattributes.exists());
- try (BufferedReader reader = new BufferedReader(
- new FileReader(gitattributes));) {
+ try (BufferedReader reader = Files
+ .newBufferedReader(gitattributes.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals(".gitattributes content should be as expected",
"/test a1 a2", content);
@@ -1142,8 +1143,8 @@ public void testRemoteRevision() throws Exception {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("submodule content should be as expected",
"branch world", content);
@@ -1169,8 +1170,8 @@ public void testDefaultRemoteRevision() throws Exception {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- try (BufferedReader reader = new BufferedReader(
- new FileReader(hello))) {
+ try (BufferedReader reader = Files.newBufferedReader(hello.toPath(),
+ UTF_8)) {
String content = reader.readLine();
assertEquals("submodule content should be as expected",
"branch world", content);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsFsckTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsFsckTest.java
index 804d744..c181125 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsFsckTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsFsckTest.java
@@ -266,4 +266,59 @@ public void testNonCommitHead() throws Exception {
"refs/heads/master");
}
+ private ObjectId insertGitModules(String contents) throws IOException {
+ ObjectId blobId = ins.insert(Constants.OBJ_BLOB,
+ Constants.encode(contents));
+
+ byte[] blobIdBytes = new byte[OBJECT_ID_LENGTH];
+ blobId.copyRawTo(blobIdBytes, 0);
+ byte[] data = concat(encodeASCII("100644 .gitmodules\0"), blobIdBytes);
+ ins.insert(Constants.OBJ_TREE, data);
+ ins.flush();
+
+ return blobId;
+ }
+
+ @Test
+ public void testInvalidGitModules() throws Exception {
+ String fakeGitmodules = new StringBuilder()
+ .append("[submodule \"test\"]\n")
+ .append(" path = xlib\n")
+ .append(" url = https://example.com/repo/xlib.git\n\n")
+ .append("[submodule \"test2\"]\n")
+ .append(" path = zlib\n")
+ .append(" url = -upayload.sh\n")
+ .toString();
+
+ ObjectId blobId = insertGitModules(fakeGitmodules);
+
+ DfsFsck fsck = new DfsFsck(repo);
+ FsckError errors = fsck.check(null);
+ assertEquals(errors.getCorruptObjects().size(), 1);
+
+ CorruptObject error = errors.getCorruptObjects().iterator().next();
+ assertEquals(error.getId(), blobId);
+ assertEquals(error.getType(), Constants.OBJ_BLOB);
+ assertEquals(error.getErrorType(), ErrorType.GITMODULES_URL);
+ }
+
+
+ @Test
+ public void testValidGitModules() throws Exception {
+ String fakeGitmodules = new StringBuilder()
+ .append("[submodule \"test\"]\n")
+ .append(" path = xlib\n")
+ .append(" url = https://example.com/repo/xlib.git\n\n")
+ .append("[submodule \"test2\"]\n")
+ .append(" path = zlib\n")
+ .append(" url = ok/path\n")
+ .toString();
+
+ insertGitModules(fakeGitmodules);
+
+ DfsFsck fsck = new DfsFsck(repo);
+ FsckError errors = fsck.check(null);
+ assertEquals(errors.getCorruptObjects().size(), 0);
+ }
+
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
index deffa04..f6cb558 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileRepositoryBuilderTest.java
@@ -43,14 +43,16 @@
package org.eclipse.jgit.internal.storage.file;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
+import java.nio.file.Files;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.lib.ConfigConstants;
@@ -120,18 +122,19 @@ public void absoluteGitDirRef() throws Exception {
Repository repo1 = createWorkRepository();
File dir = createTempDirectory("dir");
File dotGit = new File(dir, Constants.DOT_GIT);
- try (FileWriter writer = new FileWriter(dotGit)) {
- writer.append("gitdir: " + repo1.getDirectory().getAbsolutePath()).close();
- FileRepositoryBuilder builder = new FileRepositoryBuilder();
-
- builder.setWorkTree(dir);
- builder.setMustExist(true);
- Repository repo2 = builder.build();
-
- assertEquals(repo1.getDirectory().getAbsolutePath(), repo2
- .getDirectory().getAbsolutePath());
- assertEquals(dir, repo2.getWorkTree());
+ try (BufferedWriter writer = Files.newBufferedWriter(dotGit.toPath(),
+ UTF_8)) {
+ writer.append("gitdir: " + repo1.getDirectory().getAbsolutePath());
}
+ FileRepositoryBuilder builder = new FileRepositoryBuilder();
+
+ builder.setWorkTree(dir);
+ builder.setMustExist(true);
+ Repository repo2 = builder.build();
+
+ assertEquals(repo1.getDirectory().getAbsolutePath(),
+ repo2.getDirectory().getAbsolutePath());
+ assertEquals(dir, repo2.getWorkTree());
}
@Test
@@ -140,20 +143,20 @@ public void relativeGitDirRef() throws Exception {
File dir = new File(repo1.getWorkTree(), "dir");
assertTrue(dir.mkdir());
File dotGit = new File(dir, Constants.DOT_GIT);
- try (FileWriter writer = new FileWriter(dotGit)) {
- writer.append("gitdir: ../" + Constants.DOT_GIT).close();
-
- FileRepositoryBuilder builder = new FileRepositoryBuilder();
- builder.setWorkTree(dir);
- builder.setMustExist(true);
- Repository repo2 = builder.build();
-
- // The tmp directory may be a symlink so the actual path
- // may not
- assertEquals(repo1.getDirectory().getCanonicalPath(), repo2
- .getDirectory().getCanonicalPath());
- assertEquals(dir, repo2.getWorkTree());
+ try (BufferedWriter writer = Files.newBufferedWriter(dotGit.toPath(),
+ UTF_8)) {
+ writer.append("gitdir: ../" + Constants.DOT_GIT);
}
+ FileRepositoryBuilder builder = new FileRepositoryBuilder();
+ builder.setWorkTree(dir);
+ builder.setMustExist(true);
+ Repository repo2 = builder.build();
+
+ // The tmp directory may be a symlink so the actual path
+ // may not
+ assertEquals(repo1.getDirectory().getCanonicalPath(),
+ repo2.getDirectory().getCanonicalPath());
+ assertEquals(dir, repo2.getWorkTree());
}
@Test
@@ -161,22 +164,23 @@ public void scanWithGitDirRef() throws Exception {
Repository repo1 = createWorkRepository();
File dir = createTempDirectory("dir");
File dotGit = new File(dir, Constants.DOT_GIT);
- try (FileWriter writer = new FileWriter(dotGit)) {
+ try (BufferedWriter writer = Files.newBufferedWriter(dotGit.toPath(),
+ UTF_8)) {
writer.append(
- "gitdir: " + repo1.getDirectory().getAbsolutePath()).close();
- FileRepositoryBuilder builder = new FileRepositoryBuilder();
-
- builder.setWorkTree(dir);
- builder.findGitDir(dir);
- assertEquals(repo1.getDirectory().getAbsolutePath(), builder
- .getGitDir().getAbsolutePath());
- builder.setMustExist(true);
- Repository repo2 = builder.build();
-
- // The tmp directory may be a symlink
- assertEquals(repo1.getDirectory().getCanonicalPath(), repo2
- .getDirectory().getCanonicalPath());
- assertEquals(dir, repo2.getWorkTree());
+ "gitdir: " + repo1.getDirectory().getAbsolutePath());
}
+ FileRepositoryBuilder builder = new FileRepositoryBuilder();
+
+ builder.setWorkTree(dir);
+ builder.findGitDir(dir);
+ assertEquals(repo1.getDirectory().getAbsolutePath(),
+ builder.getGitDir().getAbsolutePath());
+ builder.setMustExist(true);
+ Repository repo2 = builder.build();
+
+ // The tmp directory may be a symlink
+ assertEquals(repo1.getDirectory().getCanonicalPath(),
+ repo2.getDirectory().getCanonicalPath());
+ assertEquals(dir, repo2.getWorkTree());
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
index cbb73bb..3ca689a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
@@ -42,6 +42,7 @@
package org.eclipse.jgit.internal.storage.file;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -189,7 +190,8 @@ public void testShallowFile()
String commit = "d3148f9410b071edd4a4c85d2a43d1fa2574b0d2";
try (PrintWriter writer = new PrintWriter(
- new File(repository.getDirectory(), Constants.SHALLOW))) {
+ new File(repository.getDirectory(), Constants.SHALLOW),
+ UTF_8.name())) {
writer.println(commit);
}
Set<ObjectId> shallowCommits = dir.getShallowCommits();
@@ -205,7 +207,8 @@ public void testShallowFileCorrupt()
String commit = "X3148f9410b071edd4a4c85d2a43d1fa2574b0d2";
try (PrintWriter writer = new PrintWriter(
- new File(repository.getDirectory(), Constants.SHALLOW))) {
+ new File(repository.getDirectory(), Constants.SHALLOW),
+ UTF_8.name())) {
writer.println(commit);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java
index dc05eea..acdaf3a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogReaderTest.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.internal.storage.file;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -67,31 +68,31 @@
public class ReflogReaderTest extends SampleDataRepositoryTestCase {
static byte[] oneLine = "da85355dfc525c9f6f3927b876f379f46ccf826e 3e7549db262d1e836d9bf0af7e22355468f1717c A O Thor Too <authortoo@wri.tr> 1243028200 +0200\tcommit: Add a toString for debugging to RemoteRefUpdate\n"
- .getBytes();
+ .getBytes(UTF_8);
static byte[] twoLine = ("0000000000000000000000000000000000000000 c6734895958052a9dbc396cff4459dc1a25029ab A U Thor <thor@committer.au> 1243028201 -0100\tbranch: Created from rr/renamebranchv4\n"
+ "c6734895958052a9dbc396cff4459dc1a25029ab 54794942a18a237c57a80719afed44bb78172b10 Same A U Thor <same.author@example.com> 1243028202 +0100\trebase finished: refs/heads/rr/renamebranch5 onto c6e3b9fe2da0293f11eae202ec35fb343191a82d\n")
- .getBytes();
+ .getBytes(UTF_8);
static byte[] twoLineWithAppendInProgress = ("0000000000000000000000000000000000000000 c6734895958052a9dbc396cff4459dc1a25029ab A U Thor <thor@committer.au> 1243028201 -0100\tbranch: Created from rr/renamebranchv4\n"
+ "c6734895958052a9dbc396cff4459dc1a25029ab 54794942a18a237c57a80719afed44bb78172b10 Same A U Thor <same.author@example.com> 1243028202 +0100\trebase finished: refs/heads/rr/renamebranch5 onto c6e3b9fe2da0293f11eae202ec35fb343191a82d\n"
+ "54794942a18a237c57a80719afed44bb78172b10 ")
- .getBytes();
+ .getBytes(UTF_8);
static byte[] aLine = "1111111111111111111111111111111111111111 3e7549db262d1e836d9bf0af7e22355468f1717c A U Thor <thor@committer.au> 1243028201 -0100\tbranch: change to a\n"
- .getBytes();
+ .getBytes(UTF_8);
static byte[] masterLine = "2222222222222222222222222222222222222222 3e7549db262d1e836d9bf0af7e22355468f1717c A U Thor <thor@committer.au> 1243028201 -0100\tbranch: change to master\n"
- .getBytes();
+ .getBytes(UTF_8);
static byte[] headLine = "3333333333333333333333333333333333333333 3e7549db262d1e836d9bf0af7e22355468f1717c A U Thor <thor@committer.au> 1243028201 -0100\tbranch: change to HEAD\n"
- .getBytes();
+ .getBytes(UTF_8);
static byte[] oneLineWithoutComment = "da85355dfc525c9f6f3927b876f379f46ccf826e 3e7549db262d1e836d9bf0af7e22355468f1717c A O Thor Too <authortoo@wri.tr> 1243028200 +0200\n"
- .getBytes();
+ .getBytes(UTF_8);
static byte[] switchBranch = "0d43a6890a19fd657faad1c4cfbe3cb1b47851c3 4809df9c0d8bce5b00955563f77c5a9f25aa0d12 A O Thor Too <authortoo@wri.tr> 1315088009 +0200\tcheckout: moving from new/work to master\n"
- .getBytes();
+ .getBytes(UTF_8);
@Test
public void testReadOneLine() throws Exception {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogWriterTest.java
index 1d188c3..a84be7e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogWriterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ReflogWriterTest.java
@@ -42,6 +42,7 @@
*******************************************************************************/
package org.eclipse.jgit.internal.storage.file;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.File;
@@ -73,9 +74,9 @@ public void shouldFilterLineFeedFromMessage() throws Exception {
writer.log("refs/heads/master", oldId, newId, ident,
"stash: Add\nmessage\r\nwith line feeds");
- byte[] buffer = new byte[oneLine.getBytes().length];
+ byte[] buffer = new byte[oneLine.getBytes(UTF_8).length];
readReflog(buffer);
- assertEquals(oneLine, new String(buffer));
+ assertEquals(oneLine, new String(buffer, UTF_8));
}
private void readReflog(byte[] buffer)
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
index 0207322..96caa01 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
@@ -333,9 +333,9 @@ public void test002_WriteEmptyTree2() throws IOException {
public void test002_CreateBadTree() throws Exception {
// We won't create a tree entry with an empty filename
//
+ final TreeFormatter formatter = new TreeFormatter();
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage(JGitText.get().invalidTreeZeroLengthName);
- final TreeFormatter formatter = new TreeFormatter();
formatter.append("", FileMode.TREE,
ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java
index 01426ee..9063b65 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java
@@ -141,7 +141,7 @@ private void doCacheTests() throws IOException {
}
}
- private class TestObject {
+ private static class TestObject {
ObjectId id;
int type;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java
new file mode 100644
index 0000000..627079e
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/transport/parser/FirstWantTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.internal.transport.parser;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jgit.errors.PackProtocolException;
+import org.junit.Test;
+
+public class FirstWantTest {
+
+ @Test
+ public void testFirstWantWithOptions() throws PackProtocolException {
+ String line = "want b9d4d1eb2f93058814480eae9e1b67550f46ee38 "
+ + "no-progress include-tag ofs-delta agent=JGit/unknown";
+
+ FirstWant r = FirstWant.fromLine(line);
+ assertEquals("want b9d4d1eb2f93058814480eae9e1b67550f46ee38",
+ r.getLine());
+ Set<String> capabilities = r.getCapabilities();
+ Set<String> expectedCapabilities = new HashSet<>(
+ Arrays.asList("no-progress", "include-tag", "ofs-delta",
+ "agent=JGit/unknown"));
+ assertEquals(expectedCapabilities, capabilities);
+ }
+
+ @Test
+ public void testFirstWantWithoutOptions() throws PackProtocolException {
+ String line = "want b9d4d1eb2f93058814480eae9e1b67550f46ee38";
+
+ FirstWant r = FirstWant.fromLine(line);
+ assertEquals("want b9d4d1eb2f93058814480eae9e1b67550f46ee38",
+ r.getLine());
+ assertTrue(r.getCapabilities().isEmpty());
+ }
+
+ private String makeFirstWantLine(String capability) {
+ return String.format("want b9d4d1eb2f93058814480eae9e1b67550f46ee38 %s", capability);
+ }
+
+ @Test
+ public void testFirstWantNoWhitespace() {
+ try {
+ FirstWant.fromLine(
+ "want b9d4d1eb2f93058814480eae9e1b67550f400000capability");
+ fail("Accepting first want line without SP between oid and first capability");
+ } catch (PackProtocolException e) {
+ // pass
+ }
+ }
+
+ @Test
+ public void testFirstWantOnlyWhitespace() throws PackProtocolException {
+ FirstWant r = FirstWant
+ .fromLine("want b9d4d1eb2f93058814480eae9e1b67550f46ee38 ");
+ assertEquals("want b9d4d1eb2f93058814480eae9e1b67550f46ee38",
+ r.getLine());
+ }
+
+ @Test
+ public void testFirstWantValidCapabilityNames()
+ throws PackProtocolException {
+ List<String> validNames = Arrays.asList(
+ "c", "cap", "C", "CAP", "1", "1cap", "cap-64k_test",
+ "-", "-cap",
+ "_", "_cap", "agent=pack.age/Version");
+
+ for (String capability: validNames) {
+ FirstWant r = FirstWant.fromLine(makeFirstWantLine(capability));
+ assertEquals(r.getCapabilities().size(), 1);
+ assertTrue(r.getCapabilities().contains(capability));
+ }
+ }
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
index c4c4da8..21d8d66 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
@@ -48,6 +48,7 @@
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.concurrent.TimeUnit.DAYS;
import static java.util.concurrent.TimeUnit.HOURS;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -66,11 +67,15 @@
import java.io.IOException;
import java.nio.file.Files;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
+import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
import org.eclipse.jgit.api.MergeCommand.FastForwardMode;
import org.eclipse.jgit.errors.ConfigInvalidException;
@@ -78,6 +83,7 @@
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.merge.MergeConfig;
import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
import org.junit.After;
@@ -94,6 +100,12 @@ public class ConfigTest {
// A non-ASCII whitespace character: U+2002 EN QUAD.
private static final char WS = '\u2002';
+ private static final String REFS_ORIGIN = "+refs/heads/*:refs/remotes/origin/*";
+
+ private static final String REFS_UPSTREAM = "+refs/heads/*:refs/remotes/upstream/*";
+
+ private static final String REFS_BACKUP = "+refs/heads/*:refs/remotes/backup/*";
+
@Rule
public ExpectedException expectedEx = ExpectedException.none();
@@ -690,11 +702,7 @@ public void testExplicitlySetEmptyString() throws Exception {
assertEquals("", c.getString("a", null, "y"));
assertArrayEquals(new String[]{""}, c.getStringList("a", null, "y"));
- try {
- c.getInt("a", null, "y", 1);
- } catch (IllegalArgumentException e) {
- assertEquals("Invalid integer value: a.y=", e.getMessage());
- }
+ assertEquals(1, c.getInt("a", null, "y", 1));
assertNull(c.getString("a", null, "z"));
assertArrayEquals(new String[]{}, c.getStringList("a", null, "z"));
@@ -711,11 +719,7 @@ public void testParsedEmptyString() throws Exception {
assertNull(c.getString("a", null, "y"));
assertArrayEquals(new String[]{null}, c.getStringList("a", null, "y"));
- try {
- c.getInt("a", null, "y", 1);
- } catch (IllegalArgumentException e) {
- assertEquals("Invalid integer value: a.y=", e.getMessage());
- }
+ assertEquals(1, c.getInt("a", null, "y", 1));
assertNull(c.getString("a", null, "z"));
assertArrayEquals(new String[]{}, c.getStringList("a", null, "z"));
@@ -801,11 +805,9 @@ public void testIncludeValuePathRelative() throws ConfigInvalidException {
public void testIncludeTooManyRecursions() throws IOException {
File config = tmp.newFile("config");
String include = "[include]\npath=" + pathToString(config) + "\n";
- Files.write(config.toPath(), include.getBytes());
- FileBasedConfig fbConfig = new FileBasedConfig(null, config,
- FS.DETECTED);
+ Files.write(config.toPath(), include.getBytes(UTF_8));
try {
- fbConfig.load();
+ loadConfig(config);
fail();
} catch (ConfigInvalidException cie) {
for (Throwable t = cie; t != null; t = t.getCause()) {
@@ -824,7 +826,7 @@ public void testIncludeIsNoop() throws IOException, ConfigInvalidException {
File config = tmp.newFile("config");
String fooBar = "[foo]\nbar=true\n";
- Files.write(config.toPath(), fooBar.getBytes());
+ Files.write(config.toPath(), fooBar.getBytes(UTF_8));
Config parsed = parse("[include]\npath=" + pathToString(config) + "\n");
assertFalse(parsed.getBoolean("foo", "bar", false));
@@ -835,15 +837,13 @@ public void testIncludeCaseInsensitiveSection()
throws IOException, ConfigInvalidException {
File included = tmp.newFile("included");
String content = "[foo]\nbar=true\n";
- Files.write(included.toPath(), content.getBytes());
+ Files.write(included.toPath(), content.getBytes(UTF_8));
File config = tmp.newFile("config");
content = "[Include]\npath=" + pathToString(included) + "\n";
- Files.write(config.toPath(), content.getBytes());
+ Files.write(config.toPath(), content.getBytes(UTF_8));
- FileBasedConfig fbConfig = new FileBasedConfig(null, config,
- FS.DETECTED);
- fbConfig.load();
+ FileBasedConfig fbConfig = loadConfig(config);
assertTrue(fbConfig.getBoolean("foo", "bar", false));
}
@@ -852,15 +852,13 @@ public void testIncludeCaseInsensitiveKey()
throws IOException, ConfigInvalidException {
File included = tmp.newFile("included");
String content = "[foo]\nbar=true\n";
- Files.write(included.toPath(), content.getBytes());
+ Files.write(included.toPath(), content.getBytes(UTF_8));
File config = tmp.newFile("config");
content = "[include]\nPath=" + pathToString(included) + "\n";
- Files.write(config.toPath(), content.getBytes());
+ Files.write(config.toPath(), content.getBytes(UTF_8));
- FileBasedConfig fbConfig = new FileBasedConfig(null, config,
- FS.DETECTED);
- fbConfig.load();
+ FileBasedConfig fbConfig = loadConfig(config);
assertTrue(fbConfig.getBoolean("foo", "bar", false));
}
@@ -881,15 +879,13 @@ public void testIncludeExceptionContainsFile() throws IOException {
File included = tmp.newFile("included");
String includedPath = pathToString(included);
String content = "[include]\npath=\n";
- Files.write(included.toPath(), content.getBytes());
+ Files.write(included.toPath(), content.getBytes(UTF_8));
File config = tmp.newFile("config");
String include = "[include]\npath=" + includedPath + "\n";
- Files.write(config.toPath(), include.getBytes());
- FileBasedConfig fbConfig = new FileBasedConfig(null, config,
- FS.DETECTED);
+ Files.write(config.toPath(), include.getBytes(UTF_8));
try {
- fbConfig.load();
+ loadConfig(config);
fail("Expected ConfigInvalidException");
} catch (ConfigInvalidException e) {
// Check that there is some exception in the chain that contains
@@ -904,6 +900,306 @@ public void testIncludeExceptionContainsFile() throws IOException {
}
}
+ @Test
+ public void testIncludeSetValueMustNotTouchIncludedLines1()
+ throws IOException, ConfigInvalidException {
+ File includedFile = createAllTypesIncludedContent();
+
+ File configFile = tmp.newFile("config");
+ String content = createAllTypesSampleContent("Alice Parker", false, 11,
+ 21, 31, CoreConfig.AutoCRLF.FALSE,
+ "+refs/heads/*:refs/remotes/origin/*") + "\n[include]\npath="
+ + pathToString(includedFile);
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+ assertValuesAsIncluded(fbConfig, REFS_ORIGIN, REFS_UPSTREAM);
+ assertSections(fbConfig, "user", "core", "remote", "include");
+
+ setAllValuesNew(fbConfig);
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertValuesAsIncluded(config, REFS_BACKUP, REFS_UPSTREAM);
+ assertSections(fbConfig, "user", "core", "remote", "include");
+ });
+ }
+
+ @Test
+ public void testIncludeSetValueMustNotTouchIncludedLines2()
+ throws IOException, ConfigInvalidException {
+ File includedFile = createAllTypesIncludedContent();
+
+ File configFile = tmp.newFile("config");
+ String content = "[include]\npath=" + pathToString(includedFile) + "\n"
+ + createAllTypesSampleContent("Alice Parker", false, 11, 21, 31,
+ CoreConfig.AutoCRLF.FALSE,
+ "+refs/heads/*:refs/remotes/origin/*");
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+ assertValuesAsConfig(fbConfig, REFS_UPSTREAM, REFS_ORIGIN);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+
+ setAllValuesNew(fbConfig);
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertValuesAsNew(config, REFS_UPSTREAM, REFS_BACKUP);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+ });
+ }
+
+ @Test
+ public void testIncludeSetValueOnFileWithJustContainsInclude()
+ throws IOException, ConfigInvalidException {
+ File includedFile = createAllTypesIncludedContent();
+
+ File configFile = tmp.newFile("config");
+ String content = "[include]\npath=" + pathToString(includedFile);
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+ assertValuesAsIncluded(fbConfig, REFS_UPSTREAM);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+
+ setAllValuesNew(fbConfig);
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertValuesAsNew(config, REFS_UPSTREAM, REFS_BACKUP);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+ });
+ }
+
+ @Test
+ public void testIncludeSetValueOnFileWithJustEmptySection1()
+ throws IOException, ConfigInvalidException {
+ File includedFile = createAllTypesIncludedContent();
+
+ File configFile = tmp.newFile("config");
+ String content = "[user]\n[include]\npath="
+ + pathToString(includedFile);
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+ assertValuesAsIncluded(fbConfig, REFS_UPSTREAM);
+ assertSections(fbConfig, "user", "include", "core", "remote");
+
+ setAllValuesNew(fbConfig);
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertValuesAsNewWithName(config, "Alice Muller", REFS_UPSTREAM,
+ REFS_BACKUP);
+ assertSections(fbConfig, "user", "include", "core", "remote");
+ });
+ }
+
+ @Test
+ public void testIncludeSetValueOnFileWithJustEmptySection2()
+ throws IOException, ConfigInvalidException {
+ File includedFile = createAllTypesIncludedContent();
+
+ File configFile = tmp.newFile("config");
+ String content = "[include]\npath=" + pathToString(includedFile)
+ + "\n[user]";
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+ assertValuesAsIncluded(fbConfig, REFS_UPSTREAM);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+
+ setAllValuesNew(fbConfig);
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertValuesAsNew(config, REFS_UPSTREAM, REFS_BACKUP);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+ });
+ }
+
+ @Test
+ public void testIncludeSetValueOnFileWithJustExistingSection1()
+ throws IOException, ConfigInvalidException {
+ File includedFile = createAllTypesIncludedContent();
+
+ File configFile = tmp.newFile("config");
+ String content = "[user]\nemail=alice@home\n[include]\npath="
+ + pathToString(includedFile);
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+ assertValuesAsIncluded(fbConfig, REFS_UPSTREAM);
+ assertSections(fbConfig, "user", "include", "core", "remote");
+
+ setAllValuesNew(fbConfig);
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertValuesAsNewWithName(config, "Alice Muller", REFS_UPSTREAM,
+ REFS_BACKUP);
+ assertSections(fbConfig, "user", "include", "core", "remote");
+ });
+ }
+
+ @Test
+ public void testIncludeSetValueOnFileWithJustExistingSection2()
+ throws IOException, ConfigInvalidException {
+ File includedFile = createAllTypesIncludedContent();
+
+ File configFile = tmp.newFile("config");
+ String content = "[include]\npath=" + pathToString(includedFile)
+ + "\n[user]\nemail=alice@home\n";
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+ assertValuesAsIncluded(fbConfig, REFS_UPSTREAM);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+
+ setAllValuesNew(fbConfig);
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertValuesAsNew(config, REFS_UPSTREAM, REFS_BACKUP);
+ assertSections(fbConfig, "include", "user", "core", "remote");
+ });
+ }
+
+ @Test
+ public void testIncludeUnsetSectionMustNotTouchIncludedLines()
+ throws IOException, ConfigInvalidException {
+ File includedFile = tmp.newFile("included");
+ RefSpec includedRefSpec = new RefSpec(REFS_UPSTREAM);
+ String includedContent = "[remote \"origin\"]\n" + "fetch="
+ + includedRefSpec;
+ Files.write(includedFile.toPath(), includedContent.getBytes(UTF_8));
+
+ File configFile = tmp.newFile("config");
+ RefSpec refSpec = new RefSpec(REFS_ORIGIN);
+ String content = "[include]\npath=" + pathToString(includedFile) + "\n"
+ + "[remote \"origin\"]\n" + "fetch=" + refSpec;
+ Files.write(configFile.toPath(), content.getBytes(UTF_8));
+
+ FileBasedConfig fbConfig = loadConfig(configFile);
+
+ Consumer<FileBasedConfig> assertion = config -> {
+ assertEquals(Arrays.asList(includedRefSpec, refSpec),
+ config.getRefSpecs("remote", "origin", "fetch"));
+ };
+ assertion.accept(fbConfig);
+
+ fbConfig.unsetSection("remote", "origin");
+ assertValuesAsIsSaveLoad(fbConfig, config -> {
+ assertEquals(Collections.singletonList(includedRefSpec),
+ config.getRefSpecs("remote", "origin", "fetch"));
+ });
+ }
+
+ private File createAllTypesIncludedContent() throws IOException {
+ File includedFile = tmp.newFile("included");
+ String includedContent = createAllTypesSampleContent("Alice Muller",
+ true, 10, 20, 30, CoreConfig.AutoCRLF.TRUE,
+ "+refs/heads/*:refs/remotes/upstream/*");
+ Files.write(includedFile.toPath(), includedContent.getBytes(UTF_8));
+ return includedFile;
+ }
+
+ private static void assertValuesAsIsSaveLoad(FileBasedConfig fbConfig,
+ Consumer<FileBasedConfig> assertion)
+ throws IOException, ConfigInvalidException {
+ assertion.accept(fbConfig);
+
+ fbConfig.save();
+ assertion.accept(fbConfig);
+
+ fbConfig = loadConfig(fbConfig.getFile());
+ assertion.accept(fbConfig);
+ }
+
+ private static void setAllValuesNew(Config config) {
+ config.setString("user", null, "name", "Alice Bauer");
+ config.setBoolean("core", null, "fileMode", false);
+ config.setInt("core", null, "deltaBaseCacheLimit", 12);
+ config.setLong("core", null, "packedGitLimit", 22);
+ config.setLong("core", null, "repositoryCacheExpireAfter", 32);
+ config.setEnum("core", null, "autocrlf", CoreConfig.AutoCRLF.FALSE);
+ config.setString("remote", "origin", "fetch",
+ "+refs/heads/*:refs/remotes/backup/*");
+ }
+
+ private static void assertValuesAsIncluded(Config config, String... refs) {
+ assertAllTypesSampleContent("Alice Muller", true, 10, 20, 30,
+ CoreConfig.AutoCRLF.TRUE, config, refs);
+ }
+
+ private static void assertValuesAsConfig(Config config, String... refs) {
+ assertAllTypesSampleContent("Alice Parker", false, 11, 21, 31,
+ CoreConfig.AutoCRLF.FALSE, config, refs);
+ }
+
+ private static void assertValuesAsNew(Config config, String... refs) {
+ assertValuesAsNewWithName(config, "Alice Bauer", refs);
+ }
+
+ private static void assertValuesAsNewWithName(Config config, String name,
+ String... refs) {
+ assertAllTypesSampleContent(name, false, 12, 22, 32,
+ CoreConfig.AutoCRLF.FALSE, config, refs);
+ }
+
+ private static void assertSections(Config config, String... sections) {
+ assertEquals(Arrays.asList(sections),
+ new ArrayList<>(config.getSections()));
+ }
+
+ private static String createAllTypesSampleContent(String name,
+ boolean fileMode, int deltaBaseCacheLimit, long packedGitLimit,
+ long repositoryCacheExpireAfter, CoreConfig.AutoCRLF autoCRLF,
+ String fetchRefSpec) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("[user]\n");
+ builder.append("name=");
+ builder.append(name);
+ builder.append("\n");
+
+ builder.append("[core]\n");
+ builder.append("fileMode=");
+ builder.append(fileMode);
+ builder.append("\n");
+
+ builder.append("deltaBaseCacheLimit=");
+ builder.append(deltaBaseCacheLimit);
+ builder.append("\n");
+
+ builder.append("packedGitLimit=");
+ builder.append(packedGitLimit);
+ builder.append("\n");
+
+ builder.append("repositoryCacheExpireAfter=");
+ builder.append(repositoryCacheExpireAfter);
+ builder.append("\n");
+
+ builder.append("autocrlf=");
+ builder.append(autoCRLF.name());
+ builder.append("\n");
+
+ builder.append("[remote \"origin\"]\n");
+ builder.append("fetch=");
+ builder.append(fetchRefSpec);
+ builder.append("\n");
+ return builder.toString();
+ }
+
+ private static void assertAllTypesSampleContent(String name,
+ boolean fileMode, int deltaBaseCacheLimit, long packedGitLimit,
+ long repositoryCacheExpireAfter, CoreConfig.AutoCRLF autoCRLF,
+ Config config, String... fetchRefSpecs) {
+ assertEquals(name, config.getString("user", null, "name"));
+ assertEquals(fileMode,
+ config.getBoolean("core", "fileMode", !fileMode));
+ assertEquals(deltaBaseCacheLimit,
+ config.getInt("core", "deltaBaseCacheLimit", -1));
+ assertEquals(packedGitLimit,
+ config.getLong("core", "packedGitLimit", -1));
+ assertEquals(repositoryCacheExpireAfter, config.getTimeUnit("core",
+ null, "repositoryCacheExpireAfter", -1, MILLISECONDS));
+ assertEquals(autoCRLF, config.getEnum("core", null, "autocrlf",
+ CoreConfig.AutoCRLF.INPUT));
+ final List<RefSpec> refspecs = new ArrayList<>();
+ for (String fetchRefSpec : fetchRefSpecs) {
+ refspecs.add(new RefSpec(fetchRefSpec));
+ }
+
+ assertEquals(refspecs, config.getRefSpecs("remote", "origin", "fetch"));
+ }
+
private static void assertReadLong(long exp) throws ConfigInvalidException {
assertReadLong(exp, String.valueOf(exp));
}
@@ -1217,4 +1513,12 @@ private static void assertInvalidSubsection(String expectedMessage,
assertEquals(expectedMessage, e.getMessage());
}
}
+
+ private static FileBasedConfig loadConfig(File file)
+ throws IOException, ConfigInvalidException {
+ final FileBasedConfig config = new FileBasedConfig(null, file,
+ FS.DETECTED);
+ config.load();
+ return config;
+ }
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java
index 32a1ec9..057e0c8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java
@@ -37,6 +37,7 @@
*/
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -343,7 +344,7 @@ private void testMaliciousPath(boolean good, boolean secondCheckout,
ObjectInserter newObjectInserter;
newObjectInserter = git.getRepository().newObjectInserter();
ObjectId blobId = newObjectInserter.insert(Constants.OBJ_BLOB,
- "data".getBytes());
+ "data".getBytes(UTF_8));
newObjectInserter = git.getRepository().newObjectInserter();
FileMode mode = FileMode.REGULAR_FILE;
ObjectId insertId = blobId;
@@ -366,8 +367,8 @@ private void testMaliciousPath(boolean good, boolean secondCheckout,
insertId = blobId;
for (int i = path.length - 1; i >= 0; --i) {
TreeFormatter treeFormatter = new TreeFormatter();
- treeFormatter.append(path[i].getBytes(), 0,
- path[i].getBytes().length,
+ treeFormatter.append(path[i].getBytes(UTF_8), 0,
+ path[i].getBytes(UTF_8).length,
mode, insertId, true);
insertId = newObjectInserter.insert(treeFormatter);
mode = FileMode.TREE;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
index eb87827..534b323 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
@@ -40,6 +40,7 @@
*/
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -310,7 +311,7 @@ private void assertIndex(HashMap<String, String> i)
assertTrue("unexpected content for path " + path
+ " in index. Expected: <" + expectedValue + ">",
Arrays.equals(db.open(read.getEntry(j).getObjectId())
- .getCachedBytes(), i.get(path).getBytes()));
+ .getCachedBytes(), i.get(path).getBytes(UTF_8)));
}
}
@@ -405,7 +406,7 @@ private ObjectId buildTree(HashMap<String, String> headEntries)
ObjectId genSha1(String data) {
try (ObjectInserter w = db.newObjectInserter()) {
- ObjectId id = w.insert(Constants.OBJ_BLOB, data.getBytes());
+ ObjectId id = w.insert(Constants.OBJ_BLOB, data.getBytes(UTF_8));
w.flush();
return id;
} catch (IOException e) {
@@ -928,6 +929,7 @@ public void testCheckoutHierarchy() throws IOException {
"e/g3"));
try {
checkout();
+ fail("did not throw CheckoutConflictException");
} catch (CheckoutConflictException e) {
assertWorkDir(mkmap("a", "a", "b/c", "b/c", "d", "d", "e/f",
"e/f", "e/g", "e/g3"));
@@ -2048,7 +2050,7 @@ public void assertWorkDir(Map<String, String> i)
assertArrayEquals(
"unexpected content for path " + path
+ " in workDir. ",
- buffer, i.get(path).getBytes());
+ buffer, i.get(path).getBytes(UTF_8));
}
nrFiles++;
} else if (file.isDirectory()) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java
index 347883f..abf7d56 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/MergeHeadMsgTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -72,7 +73,9 @@ public void testReadWriteMergeHeads() throws IOException {
// same test again, this time with lower-level io
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), "MERGE_HEAD"));) {
- fos.write("0000000000000000000000000000000000000000\n1c6db447abdbb291b25f07be38ea0b1bf94947c5\n".getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(
+ "0000000000000000000000000000000000000000\n1c6db447abdbb291b25f07be38ea0b1bf94947c5\n"
+ .getBytes(UTF_8));
}
assertEquals(db.readMergeHeads().size(), 2);
assertEquals(db.readMergeHeads().get(0), ObjectId.zeroId());
@@ -82,7 +85,7 @@ public void testReadWriteMergeHeads() throws IOException {
assertEquals(db.readMergeHeads(), null);
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), "MERGE_HEAD"))) {
- fos.write(sampleId.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(sampleId.getBytes(UTF_8));
}
assertEquals(db.readMergeHeads().size(), 1);
assertEquals(db.readMergeHeads().get(0), ObjectId.fromString(sampleId));
@@ -100,7 +103,7 @@ public void testReadWriteMergeMsg() throws IOException {
assertFalse(new File(db.getDirectory(), "MERGE_MSG").exists());
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), Constants.MERGE_MSG))) {
- fos.write(mergeMsg.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(mergeMsg.getBytes(UTF_8));
}
assertEquals(db.readMergeCommitMsg(), mergeMsg);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectLoaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectLoaderTest.java
index 83e61d9..055e66e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectLoaderTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectLoaderTest.java
@@ -260,6 +260,12 @@ public int read() throws IOException {
fail("never should have reached read");
return -1;
}
+
+ @Override
+ public int read(byte b[], int off, int len) {
+ fail("never should have reached read");
+ return -1;
+ }
};
}
};
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
index 3542dfa..bb24994 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.lib;
import static java.lang.Long.valueOf;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -181,7 +182,7 @@ public void testRacyGitDetection() throws Exception {
private File addToWorkDir(String path, String content) throws IOException {
File f = new File(db.getWorkTree(), path);
try (FileOutputStream fos = new FileOutputStream(f)) {
- fos.write(content.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(content.getBytes(UTF_8));
return f;
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
index a42027b..7d2c4a2 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java
@@ -45,6 +45,7 @@
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -261,7 +262,7 @@ public void testReadLoosePackedRef() throws IOException,
assertEquals(Storage.PACKED, ref.getStorage());
try (FileOutputStream os = new FileOutputStream(
new File(db.getDirectory(), "refs/heads/master"))) {
- os.write(ref.getObjectId().name().getBytes());
+ os.write(ref.getObjectId().name().getBytes(UTF_8));
os.write('\n');
}
@@ -333,4 +334,17 @@ public void testGetRefsByPrefix() throws IOException {
assertEquals(1, refs.size());
checkContainsRef(refs, db.exactRef("refs/heads/prefix/a"));
}
+
+ @Test
+ public void testGetRefsByPrefixes() throws IOException {
+ List<Ref> refs = db.getRefDatabase().getRefsByPrefix();
+ assertEquals(0, refs.size());
+
+ refs = db.getRefDatabase().getRefsByPrefix("refs/heads/p",
+ "refs/tags/A");
+ assertEquals(3, refs.size());
+ checkContainsRef(refs, db.exactRef("refs/heads/pa"));
+ checkContainsRef(refs, db.exactRef("refs/heads/prefix/a"));
+ checkContainsRef(refs, db.exactRef("refs/tags/A"));
+ }
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java
index 203c00e..f58ab06 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SquashCommitMsgTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.lib;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -68,7 +69,7 @@ public void testReadWriteMergeMsg() throws IOException {
assertFalse(new File(db.getDirectory(), Constants.SQUASH_MSG).exists());
try (FileOutputStream fos = new FileOutputStream(
new File(db.getDirectory(), Constants.SQUASH_MSG))) {
- fos.write(squashMsg.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(squashMsg.getBytes(UTF_8));
}
assertEquals(db.readSquashCommitMsg(), squashMsg);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
index 87e901f..df5079a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
@@ -270,8 +270,8 @@ public void testWindowsReservedNames() {
@Test
public void testNormalizeBranchName() {
- assertEquals(true, Repository.normalizeBranchName(null) == "");
- assertEquals(true, Repository.normalizeBranchName("").equals(""));
+ assertEquals("", Repository.normalizeBranchName(null));
+ assertEquals("", Repository.normalizeBranchName(""));
assertNormalized("Bug 12345::::Hello World", "Bug_12345-Hello_World");
assertNormalized("Bug 12345 :::: Hello World", "Bug_12345_Hello_World");
assertNormalized("Bug 12345 :::: Hello::: World",
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
index 5af62b6..3da779b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergeAlgorithmTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.merge;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
@@ -301,8 +302,8 @@ private String merge(String commonBase, String ours, String theirs) throws IOExc
MergeResult r = new MergeAlgorithm().merge(RawTextComparator.DEFAULT,
T(commonBase), T(ours), T(theirs));
ByteArrayOutputStream bo=new ByteArrayOutputStream(50);
- fmt.formatMerge(bo, r, "B", "O", "T", Constants.CHARACTER_ENCODING);
- return new String(bo.toByteArray(), Constants.CHARACTER_ENCODING);
+ fmt.formatMerge(bo, r, "B", "O", "T", UTF_8);
+ return new String(bo.toByteArray(), UTF_8);
}
public String t(String text) {
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 8f12dd7..8ca5d45 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
@@ -839,7 +839,7 @@ public ObjectReader newReader() {
/**
* Throws an exception if reading beyond limit.
*/
- class BigReadForbiddenStream extends ObjectStream.Filter {
+ static class BigReadForbiddenStream extends ObjectStream.Filter {
int limit;
BigReadForbiddenStream(ObjectStream orig, int limit) {
@@ -878,7 +878,7 @@ public int read(byte[] b, int off, int len) throws IOException {
}
}
- class BigReadForbiddenReader extends ObjectReader.Filter {
+ static class BigReadForbiddenReader extends ObjectReader.Filter {
ObjectReader delegate;
int limit;
@@ -972,7 +972,7 @@ public void checkContentMergeConflict_noTree(MergeStrategy strategy)
merger.getMergeResults().get("file");
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
fmt.formatMerge(out, merger.getMergeResults().get("file"),
- "BASE", "OURS", "THEIRS", UTF_8.name());
+ "BASE", "OURS", "THEIRS", UTF_8);
String expected = "<<<<<<< OURS\n"
+ "1master\n"
+ "=======\n"
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
index 9a6043f..7297de3 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
@@ -56,7 +56,7 @@
public class PlotCommitListTest extends RevWalkTestCase {
- class CommitListAssert {
+ static class CommitListAssert {
private PlotCommitList<PlotLane> pcl;
private PlotCommit<PlotLane> current;
private int nextIndex = 0;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
index 7f0d602..b401d2b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java
@@ -52,6 +52,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.StringTokenizer;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.util.FS;
@@ -67,16 +68,23 @@ public class FileBasedConfigTest {
private static final String NAME = "name";
+ private static final String EMAIL = "email";
+
private static final String ALICE = "Alice";
private static final String BOB = "Bob";
+ private static final String ALICE_EMAIL = "alice@home";
+
private static final String CONTENT1 = "[" + USER + "]\n\t" + NAME + " = "
+ ALICE + "\n";
private static final String CONTENT2 = "[" + USER + "]\n\t" + NAME + " = "
+ BOB + "\n";
+ private static final String CONTENT3 = "[" + USER + "]\n\t" + NAME + " = "
+ + ALICE + "\n" + "[" + USER + "]\n\t" + EMAIL + " = " + ALICE_EMAIL;
+
private File trash;
@Before
@@ -93,14 +101,14 @@ public void tearDown() throws Exception {
@Test
public void testSystemEncoding() throws IOException, ConfigInvalidException {
- final File file = createFile(CONTENT1.getBytes());
+ final File file = createFile(CONTENT1.getBytes(UTF_8));
final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
config.load();
assertEquals(ALICE, config.getString(USER, null, NAME));
config.setString(USER, null, NAME, BOB);
config.save();
- assertArrayEquals(CONTENT2.getBytes(), IO.readFully(file));
+ assertArrayEquals(CONTENT2.getBytes(UTF_8), IO.readFully(file));
}
@Test
@@ -112,7 +120,7 @@ public void testUTF8withoutBOM() throws IOException, ConfigInvalidException {
config.setString(USER, null, NAME, BOB);
config.save();
- assertArrayEquals(CONTENT2.getBytes(), IO.readFully(file));
+ assertArrayEquals(CONTENT2.getBytes(UTF_8), IO.readFully(file));
}
@Test
@@ -142,8 +150,8 @@ public void testUTF8withBOM() throws IOException, ConfigInvalidException {
@Test
public void testLeadingWhitespaces() throws IOException, ConfigInvalidException {
final ByteArrayOutputStream bos1 = new ByteArrayOutputStream();
- bos1.write(" \n\t".getBytes());
- bos1.write(CONTENT1.getBytes());
+ bos1.write(" \n\t".getBytes(UTF_8));
+ bos1.write(CONTENT1.getBytes(UTF_8));
final File file = createFile(bos1.toByteArray());
final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
@@ -154,18 +162,18 @@ public void testLeadingWhitespaces() throws IOException, ConfigInvalidException
config.save();
final ByteArrayOutputStream bos2 = new ByteArrayOutputStream();
- bos2.write(" \n\t".getBytes());
- bos2.write(CONTENT2.getBytes());
+ bos2.write(" \n\t".getBytes(UTF_8));
+ bos2.write(CONTENT2.getBytes(UTF_8));
assertArrayEquals(bos2.toByteArray(), IO.readFully(file));
}
@Test
public void testIncludeAbsolute()
throws IOException, ConfigInvalidException {
- final File includedFile = createFile(CONTENT1.getBytes());
+ final File includedFile = createFile(CONTENT1.getBytes(UTF_8));
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- bos.write("[include]\npath=".getBytes());
- bos.write(pathToString(includedFile).getBytes());
+ bos.write("[include]\npath=".getBytes(UTF_8));
+ bos.write(pathToString(includedFile).getBytes(UTF_8));
final File file = createFile(bos.toByteArray());
final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
@@ -176,10 +184,10 @@ public void testIncludeAbsolute()
@Test
public void testIncludeRelativeDot()
throws IOException, ConfigInvalidException {
- final File includedFile = createFile(CONTENT1.getBytes(), "dir1");
+ final File includedFile = createFile(CONTENT1.getBytes(UTF_8), "dir1");
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- bos.write("[include]\npath=".getBytes());
- bos.write(("./" + includedFile.getName()).getBytes());
+ bos.write("[include]\npath=".getBytes(UTF_8));
+ bos.write(("./" + includedFile.getName()).getBytes(UTF_8));
final File file = createFile(bos.toByteArray(), "dir1");
final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
@@ -190,11 +198,11 @@ public void testIncludeRelativeDot()
@Test
public void testIncludeRelativeDotDot()
throws IOException, ConfigInvalidException {
- final File includedFile = createFile(CONTENT1.getBytes(), "dir1");
+ final File includedFile = createFile(CONTENT1.getBytes(UTF_8), "dir1");
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- bos.write("[include]\npath=".getBytes());
+ bos.write("[include]\npath=".getBytes(UTF_8));
bos.write(("../" + includedFile.getParentFile().getName() + "/"
- + includedFile.getName()).getBytes());
+ + includedFile.getName()).getBytes(UTF_8));
final File file = createFile(bos.toByteArray(), "dir2");
final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
@@ -205,10 +213,10 @@ public void testIncludeRelativeDotDot()
@Test
public void testIncludeRelativeDotDotNotFound()
throws IOException, ConfigInvalidException {
- final File includedFile = createFile(CONTENT1.getBytes());
+ final File includedFile = createFile(CONTENT1.getBytes(UTF_8));
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- bos.write("[include]\npath=".getBytes());
- bos.write(("../" + includedFile.getName()).getBytes());
+ bos.write("[include]\npath=".getBytes(UTF_8));
+ bos.write(("../" + includedFile.getName()).getBytes(UTF_8));
final File file = createFile(bos.toByteArray());
final FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
@@ -219,10 +227,10 @@ public void testIncludeRelativeDotDotNotFound()
@Test
public void testIncludeWithTilde()
throws IOException, ConfigInvalidException {
- final File includedFile = createFile(CONTENT1.getBytes(), "home");
+ final File includedFile = createFile(CONTENT1.getBytes(UTF_8), "home");
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
- bos.write("[include]\npath=".getBytes());
- bos.write(("~/" + includedFile.getName()).getBytes());
+ bos.write("[include]\npath=".getBytes(UTF_8));
+ bos.write(("~/" + includedFile.getName()).getBytes(UTF_8));
final File file = createFile(bos.toByteArray(), "repo");
final FS fs = FS.DETECTED.newInstance();
@@ -233,6 +241,50 @@ public void testIncludeWithTilde()
assertEquals(ALICE, config.getString(USER, null, NAME));
}
+ @Test
+ public void testIncludeDontInlineIncludedLinesOnSave()
+ throws IOException, ConfigInvalidException {
+ // use a content with multiple sections and multiple key/value pairs
+ // because code for first line works different than for subsequent lines
+ final File includedFile = createFile(CONTENT3.getBytes(UTF_8), "dir1");
+
+ final File file = createFile(new byte[0], "dir2");
+ FileBasedConfig config = new FileBasedConfig(file, FS.DETECTED);
+ config.setString("include", null, "path",
+ ("../" + includedFile.getParentFile().getName() + "/"
+ + includedFile.getName()));
+
+ // just by setting the include.path, it won't be included
+ assertEquals(null, config.getString(USER, null, NAME));
+ assertEquals(null, config.getString(USER, null, EMAIL));
+ config.save();
+
+ // and it won't be included after saving
+ assertEquals(null, config.getString(USER, null, NAME));
+ assertEquals(null, config.getString(USER, null, EMAIL));
+
+ final String expectedText = config.toText();
+ assertEquals(2,
+ new StringTokenizer(expectedText, "\n", false).countTokens());
+
+ config = new FileBasedConfig(file, FS.DETECTED);
+ config.load();
+
+ String actualText = config.toText();
+ assertEquals(expectedText, actualText);
+ // but it will be included after (re)loading
+ assertEquals(ALICE, config.getString(USER, null, NAME));
+ assertEquals(ALICE_EMAIL, config.getString(USER, null, EMAIL));
+
+ config.save();
+
+ actualText = config.toText();
+ assertEquals(expectedText, actualText);
+ // and of course preserved after saving
+ assertEquals(ALICE, config.getString(USER, null, NAME));
+ assertEquals(ALICE_EMAIL, config.getString(USER, null, EMAIL));
+ }
+
private File createFile(byte[] content) throws IOException {
return createFile(content, null);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
index fed22c0..a0cd37e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.submodule;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PATH;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_URL;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_SUBMODULE_SECTION;
@@ -52,9 +53,10 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileWriter;
import java.io.IOException;
+import java.nio.file.Files;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.Status;
@@ -155,10 +157,12 @@ public void repositoryWithRootLevelSubmoduleAbsoluteRef()
if (!dotGit.getParentFile().exists())
dotGit.getParentFile().mkdirs();
- File modulesGitDir = new File(db.getDirectory(), "modules"
- + File.separatorChar + path);
- new FileWriter(dotGit).append(
- "gitdir: " + modulesGitDir.getAbsolutePath()).close();
+ File modulesGitDir = new File(db.getDirectory(),
+ "modules" + File.separatorChar + path);
+ try (BufferedWriter fw = Files.newBufferedWriter(dotGit.toPath(),
+ UTF_8)) {
+ fw.append("gitdir: " + modulesGitDir.getAbsolutePath());
+ }
FileRepositoryBuilder builder = new FileRepositoryBuilder();
builder.setWorkTree(new File(db.getWorkTree(), path));
builder.build().create();
@@ -209,9 +213,11 @@ public void repositoryWithRootLevelSubmoduleRelativeRef()
File modulesGitDir = new File(db.getDirectory(), "modules"
+ File.separatorChar + path);
- new FileWriter(dotGit).append(
- "gitdir: " + "../" + Constants.DOT_GIT + "/modules/" + path)
- .close();
+ try (BufferedWriter fw = Files.newBufferedWriter(dotGit.toPath(),
+ UTF_8)) {
+ fw.append("gitdir: " + "../" + Constants.DOT_GIT + "/modules/"
+ + path);
+ }
FileRepositoryBuilder builder = new FileRepositoryBuilder();
builder.setWorkTree(new File(db.getWorkTree(), path));
builder.build().create();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java
index 391a701..ad8ae42 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineOutTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -50,7 +51,6 @@
import java.io.IOException;
import java.io.OutputStream;
-import org.eclipse.jgit.lib.Constants;
import org.junit.Before;
import org.junit.Test;
@@ -173,8 +173,8 @@ public void flush() throws IOException {
assertEquals(1, flushCnt[0]);
}
- private void assertBuffer(String exp) throws IOException {
+ private void assertBuffer(String exp) {
assertEquals(exp, new String(rawOut.toByteArray(),
- Constants.CHARACTER_ENCODING));
+ UTF_8));
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
index 4d11508..7cfe66f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ProtocolV2ParserTest.java
@@ -45,6 +45,7 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@@ -162,15 +163,15 @@ public void testFetchBasicArguments()
ConfigBuilder.getDefault());
FetchV2Request request = parser.parseFetchRequest(pckIn,
testRepo.getRepository().getRefDatabase());
- assertTrue(request.getOptions()
+ assertTrue(request.getClientCapabilities()
.contains(GitProtocolConstants.OPTION_THIN_PACK));
- assertTrue(request.getOptions()
+ assertTrue(request.getClientCapabilities()
.contains(GitProtocolConstants.OPTION_NO_PROGRESS));
- assertTrue(request.getOptions()
+ assertTrue(request.getClientCapabilities()
.contains(GitProtocolConstants.OPTION_INCLUDE_TAG));
- assertTrue(request.getOptions()
+ assertTrue(request.getClientCapabilities()
.contains(GitProtocolConstants.CAPABILITY_OFS_DELTA));
- assertThat(objIdsAsStrings(request.getWantsIds()),
+ assertThat(objIdsAsStrings(request.getWantIds()),
hasItems("4624442d68ee402a94364191085b77137618633e",
"f900c8326a43303685c46b279b9f70411bff1a4b"));
assertThat(objIdsAsStrings(request.getPeerHas()),
@@ -198,7 +199,7 @@ public void testFetchWithShallow_deepen() throws IOException {
"145e683b229dcab9d0e2ccb01b386f9ecc17d29d"));
assertTrue(request.getDeepenNotRefs().isEmpty());
assertEquals(15, request.getDepth());
- assertTrue(request.getOptions()
+ assertTrue(request.getClientCapabilities()
.contains(GitProtocolConstants.OPTION_DEEPEN_RELATIVE));
}
@@ -263,25 +264,26 @@ public void testFetchWithBlobSizeFilter() throws IOException {
@Test
public void testFetchMustNotHaveMultipleFilters() throws IOException {
- thrown.expect(PackProtocolException.class);
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
"filter blob:none",
"filter blob:limit=12",
PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.start().allowFilter().done());
- FetchV2Request request = parser.parseFetchRequest(pckIn,
+
+ thrown.expect(PackProtocolException.class);
+ parser.parseFetchRequest(pckIn,
testRepo.getRepository().getRefDatabase());
- assertEquals(0, request.getFilterBlobLimit());
}
@Test
public void testFetchFilterWithoutAllowFilter() throws IOException {
- thrown.expect(PackProtocolException.class);
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
"filter blob:limit=12", PacketLineIn.END);
ProtocolV2Parser parser = new ProtocolV2Parser(
ConfigBuilder.getDefault());
+
+ thrown.expect(PackProtocolException.class);
parser.parseFetchRequest(pckIn,
testRepo.getRepository().getRefDatabase());
}
@@ -306,17 +308,14 @@ public void testFetchWithRefInWant() throws Exception {
assertEquals(1, request.getWantedRefs().size());
assertThat(request.getWantedRefs().keySet(),
hasItems("refs/heads/branchA"));
- assertEquals(2, request.getWantsIds().size());
- assertThat(objIdsAsStrings(request.getWantsIds()),
+ assertEquals(2, request.getWantIds().size());
+ assertThat(objIdsAsStrings(request.getWantIds()),
hasItems("e4980cdc48cfa1301493ca94eb70523f6788b819",
one.getName()));
}
@Test
public void testFetchWithRefInWantUnknownRef() throws Exception {
- thrown.expect(PackProtocolException.class);
- thrown.expectMessage(containsString("refs/heads/branchC"));
-
PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
"want e4980cdc48cfa1301493ca94eb70523f6788b819",
"want-ref refs/heads/branchC",
@@ -329,8 +328,66 @@ public void testFetchWithRefInWantUnknownRef() throws Exception {
testRepo.update("branchA", one);
testRepo.update("branchB", two);
+ thrown.expect(PackProtocolException.class);
+ thrown.expectMessage(containsString("refs/heads/branchC"));
parser.parseFetchRequest(pckIn,
testRepo.getRepository().getRefDatabase());
}
+ @Test
+ public void testLsRefsMinimalReq() throws IOException {
+ PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
+ PacketLineIn.END);
+
+ ProtocolV2Parser parser = new ProtocolV2Parser(
+ ConfigBuilder.getDefault());
+ LsRefsV2Request req = parser.parseLsRefsRequest(pckIn);
+ assertFalse(req.getPeel());
+ assertFalse(req.getSymrefs());
+ assertEquals(0, req.getRefPrefixes().size());
+ }
+
+ @Test
+ public void testLsRefsSymrefs() throws IOException {
+ PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM, "symrefs",
+ PacketLineIn.END);
+
+ ProtocolV2Parser parser = new ProtocolV2Parser(
+ ConfigBuilder.getDefault());
+ LsRefsV2Request req = parser.parseLsRefsRequest(pckIn);
+ assertFalse(req.getPeel());
+ assertTrue(req.getSymrefs());
+ assertEquals(0, req.getRefPrefixes().size());
+
+ }
+
+ @Test
+ public void testLsRefsPeel() throws IOException {
+ PacketLineIn pckIn = formatAsPacketLine(
+ PacketLineIn.DELIM,
+ "peel",
+ PacketLineIn.END);
+
+ ProtocolV2Parser parser = new ProtocolV2Parser(
+ ConfigBuilder.getDefault());
+ LsRefsV2Request req = parser.parseLsRefsRequest(pckIn);
+ assertTrue(req.getPeel());
+ assertFalse(req.getSymrefs());
+ assertEquals(0, req.getRefPrefixes().size());
+ }
+
+ @Test
+ public void testLsRefsRefPrefixes() throws IOException {
+ PacketLineIn pckIn = formatAsPacketLine(PacketLineIn.DELIM,
+ "ref-prefix refs/for", "ref-prefix refs/heads",
+ PacketLineIn.END);
+
+ ProtocolV2Parser parser = new ProtocolV2Parser(
+ ConfigBuilder.getDefault());
+ LsRefsV2Request req = parser.parseLsRefsRequest(pckIn);
+ assertFalse(req.getPeel());
+ assertFalse(req.getSymrefs());
+ assertEquals(2, req.getRefPrefixes().size());
+ assertThat(req.getRefPrefixes(), hasItems("refs/for", "refs/heads"));
+ }
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java
index 0647167..4bf26b6 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateParserTest.java
@@ -42,6 +42,7 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -334,7 +335,7 @@ public void testParseMultipleFromStream() throws Exception {
assertFalse(input.contains(PushCertificateParser.END_CERT));
input += input;
Reader reader = new InputStreamReader(
- new ByteArrayInputStream(Constants.encode(input)));
+ new ByteArrayInputStream(Constants.encode(input)), UTF_8);
assertNotNull(PushCertificateParser.fromReader(reader));
assertNotNull(PushCertificateParser.fromReader(reader));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateStoreTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateStoreTest.java
index 68e0129..fa4fd65 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateStoreTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushCertificateStoreTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.ObjectId.zeroId;
import static org.eclipse.jgit.lib.RefUpdate.Result.FAST_FORWARD;
import static org.eclipse.jgit.lib.RefUpdate.Result.LOCK_FAILURE;
@@ -96,7 +97,9 @@ private static PushCertificate newCert(String... updateLines) {
+ "-----END PGP SIGNATURE-----\n");
try {
return PushCertificateParser.fromReader(new InputStreamReader(
- new ByteArrayInputStream(Constants.encode(cert.toString()))));
+ new ByteArrayInputStream(
+ Constants.encode(cert.toString())),
+ UTF_8));
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
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 c959f6c..dfa50b6 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
@@ -492,9 +492,8 @@ public void testIncludesInvalidGitmodules() throws Exception {
assertSame(PacketLineIn.END, r.readString());
String errorLine = r.readString();
- System.out.println(errorLine);
- assertTrue(errorLine.startsWith(
- "unpack error Invalid submodule URL '-"));
+ assertTrue(errorLine.startsWith("unpack error"));
+ assertTrue(errorLine.contains("Invalid submodule URL '-"));
assertEquals("ng refs/heads/s n/a (unpacker error)", r.readString());
assertSame(PacketLineIn.END, r.readString());
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
index 4d3e162..b6cf356 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SideBandOutputStreamTest.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.transport;
import static java.lang.Integer.valueOf;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_DATA;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_ERROR;
import static org.eclipse.jgit.transport.SideBandOutputStream.CH_PROGRESS;
@@ -59,7 +60,6 @@
import java.text.MessageFormat;
import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.Constants;
import org.junit.Before;
import org.junit.Test;
@@ -259,8 +259,7 @@ public void testConstructor_RejectsBadBufferSize() throws Exception {
}
}
- private void assertBuffer(String exp) throws IOException {
- assertEquals(exp, new String(rawOut.toByteArray(),
- Constants.CHARACTER_ENCODING));
+ private void assertBuffer(String exp) {
+ assertEquals(exp, new String(rawOut.toByteArray(), UTF_8));
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java
index 953c9fc..1c4d0cf 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java
@@ -46,6 +46,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.List;
@@ -238,6 +239,7 @@ public UploadPack create(User req, Repository db)
.setRemote(user1Uri.toString())
.setRefSpecs(MASTER)
.call();
+ fail("accepted not permitted fetch");
} catch (InvalidRemoteException expected) {
// Expected.
}
@@ -282,6 +284,7 @@ public ReceivePack create(User req, Repository db)
.setRemote(user1Uri.toString())
.setRefSpecs(HEADS)
.call();
+ fail("accepted not permitted push");
} catch (TransportException expected) {
assertTrue(expected.getMessage().contains(
JGitText.get().pushNotPermitted));
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 317ac32..aaef458 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
@@ -7,6 +7,7 @@
import static org.hamcrest.Matchers.theInstance;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -27,6 +28,7 @@
import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.NullProgressMonitor;
+import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
@@ -484,6 +486,8 @@ private static class TestV2Hook implements ProtocolV2Hook {
private LsRefsV2Request lsRefsRequest;
+ private FetchV2Request fetchRequest;
+
@Override
public void onCapabilities(CapabilitiesV2Request req) {
capabilitiesRequest = req;
@@ -493,6 +497,11 @@ public void onCapabilities(CapabilitiesV2Request req) {
public void onLsRefs(LsRefsV2Request req) {
lsRefsRequest = req;
}
+
+ @Override
+ public void onFetch(FetchV2Request req) {
+ fetchRequest = req;
+ }
}
@Test
@@ -501,18 +510,18 @@ public void testV2Capabilities() throws Exception {
ByteArrayInputStream recvStream =
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()),
- // TODO(jonathantanmy) This check is written this way
- // to make it simple to see that we expect this list of
- // capabilities, but probably should be loosened to
- // allow additional commands to be added to the list,
- // and additional capabilities to be added to existing
- // commands without requiring test changes.
- hasItems("ls-refs", "fetch=shallow"));
+ Arrays.asList(pckIn.readString(), pckIn.readString(),
+ pckIn.readString()),
+ // TODO(jonathantanmy) This check is written this way
+ // to make it simple to see that we expect this list of
+ // capabilities, but probably should be loosened to
+ // allow additional commands to be added to the list,
+ // and additional capabilities to be added to existing
+ // commands without requiring test changes.
+ hasItems("ls-refs", "fetch=shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
}
@@ -525,10 +534,11 @@ public void testV2CapabilitiesAllowFilter() throws Exception {
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=filter shallow"));
+ Arrays.asList(pckIn.readString(), pckIn.readString(),
+ pckIn.readString()),
+ // TODO(jonathantanmy) This check overspecifies the
+ // order of the capabilities of "fetch".
+ hasItems("ls-refs", "fetch=filter shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
}
@@ -541,10 +551,12 @@ public void testV2CapabilitiesRefInWant() throws Exception {
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"));
+ Arrays.asList(pckIn.readString(), pckIn.readString(),
+ pckIn.readString()),
+ // TODO(jonathantanmy) This check overspecifies the
+ // order of the capabilities of "fetch".
+ hasItems("ls-refs", "fetch=ref-in-want shallow",
+ "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
}
@@ -557,8 +569,9 @@ public void testV2CapabilitiesRefInWantNotAdvertisedIfUnallowed() throws Excepti
assertThat(pckIn.readString(), is("version 2"));
assertThat(
- Arrays.asList(pckIn.readString(), pckIn.readString()),
- hasItems("ls-refs", "fetch=shallow"));
+ Arrays.asList(pckIn.readString(), pckIn.readString(),
+ pckIn.readString()),
+ hasItems("ls-refs", "fetch=shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
}
@@ -572,8 +585,9 @@ public void testV2CapabilitiesRefInWantNotAdvertisedIfAdvertisingForbidden() thr
assertThat(pckIn.readString(), is("version 2"));
assertThat(
- Arrays.asList(pckIn.readString(), pckIn.readString()),
- hasItems("ls-refs", "fetch=shallow"));
+ Arrays.asList(pckIn.readString(), pckIn.readString(),
+ pckIn.readString()),
+ hasItems("ls-refs", "fetch=shallow", "server-option"));
assertTrue(pckIn.readString() == PacketLineIn.END);
}
@@ -718,6 +732,21 @@ public void testV2LsRefsUnrecognizedArgument() throws Exception {
PacketLineIn.END);
}
+ @Test
+ public void testV2LsRefsServerOptions() throws Exception {
+ String[] lines = { "command=ls-refs\n",
+ "server-option=one\n", "server-option=two\n",
+ PacketLineIn.DELIM,
+ PacketLineIn.END };
+
+ TestV2Hook testHook = new TestV2Hook();
+ uploadPackV2Setup(null, null, testHook, lines);
+
+ LsRefsV2Request req = testHook.lsRefsRequest;
+ assertEquals(2, req.getServerOptions().size());
+ assertThat(req.getServerOptions(), hasItems("one", "two"));
+ }
+
/*
* Parse multiplexed packfile output from upload-pack using protocol V2
* into the client repository.
@@ -1191,6 +1220,59 @@ public void testV2FetchDeepenWithoutDone() throws Exception {
}
@Test
+ public void testV2FetchShallowSince() throws Exception {
+ PersonIdent person = new PersonIdent(remote.getRepository());
+
+ RevCommit beyondBoundary = remote.commit()
+ .committer(new PersonIdent(person, 1510000000, 0)).create();
+ RevCommit boundary = remote.commit().parent(beyondBoundary)
+ .committer(new PersonIdent(person, 1520000000, 0)).create();
+ RevCommit tooOld = remote.commit()
+ .committer(new PersonIdent(person, 1500000000, 0)).create();
+ RevCommit merge = remote.commit().parent(boundary).parent(tooOld)
+ .committer(new PersonIdent(person, 1530000000, 0)).create();
+
+ remote.update("branch1", merge);
+
+ // Report that we only have "boundary" as a shallow boundary.
+ ByteArrayInputStream recvStream = uploadPackV2(
+ "command=fetch\n",
+ PacketLineIn.DELIM,
+ "shallow " + boundary.toObjectId().getName() + "\n",
+ "deepen-since 1510000\n",
+ "want " + merge.toObjectId().getName() + "\n",
+ "have " + boundary.toObjectId().getName() + "\n",
+ "done\n",
+ PacketLineIn.END);
+ PacketLineIn pckIn = new PacketLineIn(recvStream);
+ assertThat(pckIn.readString(), is("shallow-info"));
+
+ // "merge" is shallow because one of its parents is committed
+ // earlier than the given deepen-since time.
+ assertThat(pckIn.readString(), is("shallow " + merge.toObjectId().getName()));
+
+ // "boundary" is unshallow because its parent committed at or
+ // later than the given deepen-since time.
+ assertThat(pckIn.readString(), is("unshallow " + boundary.toObjectId().getName()));
+
+ assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM));
+ assertThat(pckIn.readString(), is("packfile"));
+ parsePack(recvStream);
+
+ // The server does not send this because it is committed
+ // earlier than the given deepen-since time.
+ assertFalse(client.hasObject(tooOld.toObjectId()));
+
+ // The server does not send this because the client claims to
+ // have it.
+ assertFalse(client.hasObject(boundary.toObjectId()));
+
+ // The server sends both these commits.
+ assertTrue(client.hasObject(beyondBoundary.toObjectId()));
+ assertTrue(client.hasObject(merge.toObjectId()));
+ }
+
+ @Test
public void testV2FetchUnrecognizedArgument() throws Exception {
thrown.expect(PackProtocolException.class);
thrown.expectMessage("unexpected invalid-argument");
@@ -1202,6 +1284,21 @@ public void testV2FetchUnrecognizedArgument() throws Exception {
}
@Test
+ public void testV2FetchServerOptions() throws Exception {
+ String[] lines = { "command=fetch\n", "server-option=one\n",
+ "server-option=two\n", PacketLineIn.DELIM,
+ PacketLineIn.END };
+
+ TestV2Hook testHook = new TestV2Hook();
+ uploadPackV2Setup(null, null, testHook, lines);
+
+ FetchV2Request req = testHook.fetchRequest;
+ assertNotNull(req);
+ assertEquals(2, req.getServerOptions().size());
+ assertThat(req.getServerOptions(), hasItems("one", "two"));
+ }
+
+ @Test
public void testV2FetchFilter() throws Exception {
RevBlob big = remote.blob("foobar");
RevBlob small = remote.blob("fooba");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
index f2fb022..4750d15 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
@@ -651,7 +651,8 @@ static void configCreate(String algorithm) throws Exception {
Properties props = Props.discover();
props.put(AmazonS3.Keys.PASSWORD, JGIT_PASS);
props.put(AmazonS3.Keys.CRYPTO_ALG, algorithm);
- try (PrintWriter writer = new PrintWriter(JGIT_CONF_FILE)) {
+ try (PrintWriter writer = new PrintWriter(JGIT_CONF_FILE,
+ UTF_8.name())) {
props.store(writer, "JGIT S3 connection configuration file.");
}
}
@@ -665,7 +666,8 @@ static void configCreate(String algorithm) throws Exception {
static void configCreate(Properties source) throws Exception {
Properties target = Props.discover();
target.putAll(source);
- try (PrintWriter writer = new PrintWriter(JGIT_CONF_FILE)) {
+ try (PrintWriter writer = new PrintWriter(JGIT_CONF_FILE,
+ UTF_8.name())) {
target.store(writer, "JGIT S3 connection configuration file.");
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
index 934984f..8afd49a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
@@ -66,7 +66,7 @@ private static String prefix(String path) {
return s > 0 ? path.substring(0, s) : "";
}
- public class FakeTreeIterator extends WorkingTreeIterator {
+ public static class FakeTreeIterator extends WorkingTreeIterator {
public FakeTreeIterator(String pathName, FileMode fileMode) {
super(prefix(pathName), new Config().get(WorkingTreeOptions.KEY));
mode = fileMode.getBits();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java
index cba35d8..ea5db09 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/InterIndexDiffFilterTest.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.treewalk.filter;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -114,7 +115,7 @@ public void apply(DirCacheEntry ent) {
}
private ObjectId id(String data) {
- byte[] bytes = data.getBytes();
+ byte[] bytes = data.getBytes(UTF_8);
return db.newObjectInserter().idFor(Constants.OBJ_BLOB, bytes);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java
index 0a3de85..dca9c57 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java
@@ -47,6 +47,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.Iterator;
@@ -84,18 +85,21 @@ public void testGet() {
try {
list.get(-1);
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(-1), badIndex.getMessage());
}
try {
list.get(0);
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(0), badIndex.getMessage());
}
try {
list.get(4);
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(4), badIndex.getMessage());
}
@@ -114,6 +118,7 @@ public void testGet() {
try {
list.get(3);
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(3), badIndex.getMessage());
}
@@ -125,18 +130,21 @@ public void testSet() {
try {
list.set(-1, "foo");
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(-1), badIndex.getMessage());
}
try {
list.set(0, "foo");
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(0), badIndex.getMessage());
}
try {
list.set(4, "foo");
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(4), badIndex.getMessage());
}
@@ -161,6 +169,7 @@ public void testSet() {
try {
list.set(3, "bar");
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(3), badIndex.getMessage());
}
@@ -323,12 +332,14 @@ public void testAddRejectsBadIndexes() {
try {
list.add(-1, Integer.valueOf(42));
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(-1), badIndex.getMessage());
}
try {
list.add(4, Integer.valueOf(42));
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(4), badIndex.getMessage());
}
@@ -341,12 +352,14 @@ public void testRemoveRejectsBadIndexes() {
try {
list.remove(-1);
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(-1), badIndex.getMessage());
}
try {
list.remove(4);
+ fail("accepted out-of-bounds index");
} catch (IndexOutOfBoundsException badIndex) {
assertEquals(String.valueOf(4), badIndex.getMessage());
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IOReadLineTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IOReadLineTest.java
index 928fb2e..fa303ec 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IOReadLineTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/IOReadLineTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.util;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.BufferedReader;
@@ -105,7 +106,7 @@ private String readLine(Reader r) throws Exception {
private Reader newReader(String in) {
Reader r = new InputStreamReader(
- new ByteArrayInputStream(Constants.encode(in)));
+ new ByteArrayInputStream(Constants.encode(in)), UTF_8);
if (buffered) {
r = new BufferedReader(r);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RunExternalScriptTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RunExternalScriptTest.java
index 7c0985e..19af836 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RunExternalScriptTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RunExternalScriptTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.util;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream;
@@ -75,10 +76,10 @@ public void testCopyStdIn() throws IOException, InterruptedException {
File script = writeTempFile("cat -");
int rc = FS.DETECTED.runProcess(
new ProcessBuilder("sh", script.getPath()), out, err,
- new ByteArrayInputStream(inputStr.getBytes()));
+ new ByteArrayInputStream(inputStr.getBytes(UTF_8)));
assertEquals(0, rc);
- assertEquals(inputStr, new String(out.toByteArray()));
- assertEquals("", new String(err.toByteArray()));
+ assertEquals(inputStr, new String(out.toByteArray(), UTF_8));
+ assertEquals("", new String(err.toByteArray(), UTF_8));
}
@Test
@@ -88,8 +89,8 @@ public void testCopyNullStdIn() throws IOException, InterruptedException {
new ProcessBuilder("sh", script.getPath()), out, err,
(InputStream) null);
assertEquals(0, rc);
- assertEquals("", new String(out.toByteArray()));
- assertEquals("", new String(err.toByteArray()));
+ assertEquals("", new String(out.toByteArray(), UTF_8));
+ assertEquals("", new String(err.toByteArray(), UTF_8));
}
@Test
@@ -99,8 +100,8 @@ public void testArguments() throws IOException, InterruptedException {
new ProcessBuilder("sh",
script.getPath(), "a", "b", "c"), out, err, (InputStream) null);
assertEquals(0, rc);
- assertEquals("3,a,b,c,,,\n", new String(out.toByteArray()));
- assertEquals("", new String(err.toByteArray()));
+ assertEquals("3,a,b,c,,,\n", new String(out.toByteArray(), UTF_8));
+ assertEquals("", new String(err.toByteArray(), UTF_8));
}
@Test
@@ -110,8 +111,8 @@ public void testRc() throws IOException, InterruptedException {
new ProcessBuilder("sh", script.getPath(), "a", "b", "c"),
out, err, (InputStream) null);
assertEquals(3, rc);
- assertEquals("", new String(out.toByteArray()));
- assertEquals("", new String(err.toByteArray()));
+ assertEquals("", new String(out.toByteArray(), UTF_8));
+ assertEquals("", new String(err.toByteArray(), UTF_8));
}
@Test
@@ -121,8 +122,8 @@ public void testNullStdout() throws IOException, InterruptedException {
new ProcessBuilder("sh", script.getPath()), null, err,
(InputStream) null);
assertEquals(0, rc);
- assertEquals("", new String(out.toByteArray()));
- assertEquals("", new String(err.toByteArray()));
+ assertEquals("", new String(out.toByteArray(), UTF_8));
+ assertEquals("", new String(err.toByteArray(), UTF_8));
}
@Test
@@ -132,8 +133,8 @@ public void testStdErr() throws IOException, InterruptedException {
new ProcessBuilder("sh", script.getPath()), null, err,
(InputStream) null);
assertEquals(0, rc);
- assertEquals("", new String(out.toByteArray()));
- assertEquals("hi" + LF, new String(err.toByteArray()));
+ assertEquals("", new String(out.toByteArray(), UTF_8));
+ assertEquals("hi" + LF, new String(err.toByteArray(), UTF_8));
}
@Test
@@ -142,10 +143,10 @@ public void testAllTogetherBin() throws IOException, InterruptedException {
File script = writeTempFile("echo $#,$1,$2,$3,$4,$5,$6 >&2 ; cat -; exit 5");
int rc = FS.DETECTED.runProcess(
new ProcessBuilder("sh", script.getPath(), "a", "b", "c"),
- out, err, new ByteArrayInputStream(inputStr.getBytes()));
+ out, err, new ByteArrayInputStream(inputStr.getBytes(UTF_8)));
assertEquals(5, rc);
- assertEquals(inputStr, new String(out.toByteArray()));
- assertEquals("3,a,b,c,,," + LF, new String(err.toByteArray()));
+ assertEquals(inputStr, new String(out.toByteArray(), UTF_8));
+ assertEquals("3,a,b,c,,," + LF, new String(err.toByteArray(), UTF_8));
}
@Test(expected = IOException.class)
@@ -172,10 +173,11 @@ public void testCopyStdInExecute()
File script = writeTempFile("cat -");
ProcessBuilder pb = new ProcessBuilder("sh", script.getPath());
ExecutionResult res = FS.DETECTED.execute(pb,
- new ByteArrayInputStream(inputStr.getBytes()));
+ new ByteArrayInputStream(inputStr.getBytes(UTF_8)));
assertEquals(0, res.getRc());
- assertEquals(inputStr, new String(res.getStdout().toByteArray()));
- assertEquals("", new String(res.getStderr().toByteArray()));
+ assertEquals(inputStr,
+ new String(res.getStdout().toByteArray(), UTF_8));
+ assertEquals("", new String(res.getStderr().toByteArray(), UTF_8));
}
@Test
@@ -184,8 +186,9 @@ public void testStdErrExecute() throws IOException, InterruptedException {
ProcessBuilder pb = new ProcessBuilder("sh", script.getPath());
ExecutionResult res = FS.DETECTED.execute(pb, null);
assertEquals(0, res.getRc());
- assertEquals("", new String(res.getStdout().toByteArray()));
- assertEquals("hi" + LF, new String(res.getStderr().toByteArray()));
+ assertEquals("", new String(res.getStdout().toByteArray(), UTF_8));
+ assertEquals("hi" + LF,
+ new String(res.getStderr().toByteArray(), UTF_8));
}
@Test
@@ -197,11 +200,12 @@ public void testAllTogetherBinExecute()
ProcessBuilder pb = new ProcessBuilder("sh", script.getPath(), "a",
"b", "c");
ExecutionResult res = FS.DETECTED.execute(pb,
- new ByteArrayInputStream(inputStr.getBytes()));
+ new ByteArrayInputStream(inputStr.getBytes(UTF_8)));
assertEquals(5, res.getRc());
- assertEquals(inputStr, new String(res.getStdout().toByteArray()));
+ assertEquals(inputStr,
+ new String(res.getStdout().toByteArray(), UTF_8));
assertEquals("3,a,b,c,,," + LF,
- new String(res.getStderr().toByteArray()));
+ new String(res.getStderr().toByteArray(), UTF_8));
}
private File writeTempFile(String body) throws IOException {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFInputStreamTest.java
index 1272e16..8f77c55 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFInputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFInputStreamTest.java
@@ -43,6 +43,8 @@
package org.eclipse.jgit.util.io;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -89,8 +91,8 @@ private void assertNoCrLf(String string, String string2) throws IOException {
private void assertNoCrLfHelper(String expect, String input)
throws IOException {
- byte[] inbytes = input.getBytes();
- byte[] expectBytes = expect.getBytes();
+ byte[] inbytes = input.getBytes(UTF_8);
+ byte[] expectBytes = expect.getBytes(UTF_8);
for (int i = 0; i < 5; ++i) {
byte[] buf = new byte[i];
try (ByteArrayInputStream bis = new ByteArrayInputStream(inbytes);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFOutputStreamTest.java
index 0655827..3a3dc81 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/AutoCRLFOutputStreamTest.java
@@ -44,6 +44,8 @@
package org.eclipse.jgit.util.io;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -91,8 +93,8 @@ private void assertNoCrLf(String string, String string2) throws IOException {
private void assertNoCrLfHelper(String expect, String input)
throws IOException {
- byte[] inbytes = input.getBytes();
- byte[] expectBytes = expect.getBytes();
+ byte[] inbytes = input.getBytes(UTF_8);
+ byte[] expectBytes = expect.getBytes(UTF_8);
for (int i = -4; i < 5; ++i) {
int size = Math.abs(i);
byte[] buf = new byte[size];
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
index a63b1cb..c35f90c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
@@ -282,7 +282,7 @@ private static long now() {
return System.currentTimeMillis();
}
- private final class FullPipeInputStream extends PipedInputStream {
+ private static final class FullPipeInputStream extends PipedInputStream {
FullPipeInputStream(PipedOutputStream src) throws IOException {
super(src);
src.write(new byte[PIPE_SIZE]);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java
index b824fae..a6e0eed 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/UnionInputStreamTest.java
@@ -167,6 +167,8 @@ public void testSkip() throws IOException {
u.add(new ByteArrayInputStream(new byte[] { 20, 30 }) {
@Override
+ @SuppressWarnings("UnsynchronizedOverridesSynchronized")
+ // This is only used in tests and is thread-safe
public long skip(long n) {
return 0;
}
@@ -259,6 +261,11 @@ public void testNonBlockingPartialRead() throws Exception {
public int read() throws IOException {
throw new IOException("Expected");
}
+
+ @Override
+ public int read(byte b[], int off, int len) throws IOException {
+ throw new IOException("Expected");
+ }
};
@SuppressWarnings("resource" /* java 7 */)
final UnionInputStream u = new UnionInputStream(
diff --git a/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs
index 89394ec..525ac67 100644
--- a/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit.ui/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit.ui/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit.ui/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit.ui/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
index 9b94df9..889a629 100644
--- a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
@@ -4,14 +4,14 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit.ui
Bundle-SymbolicName: org.eclipse.jgit.ui
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Vendor: %provider_name
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.jgit.awtui;version="5.1.4"
-Import-Package: org.eclipse.jgit.errors;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.lib;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.nls;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revplot;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.revwalk;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.transport;version="[5.1.4,5.2.0)",
- org.eclipse.jgit.util;version="[5.1.4,5.2.0)"
+Export-Package: org.eclipse.jgit.awtui;version="5.2.0"
+Import-Package: org.eclipse.jgit.errors;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.nls;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revplot;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.revwalk;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
+ org.eclipse.jgit.util;version="[5.2.0,5.3.0)"
diff --git a/org.eclipse.jgit.ui/pom.xml b/org.eclipse.jgit.ui/pom.xml
index 9e47b24..08f9c10 100644
--- a/org.eclipse.jgit.ui/pom.xml
+++ b/org.eclipse.jgit.ui/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ui</artifactId>
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index f96336d..e4b7ba7 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -1,13 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jgit" version="2">
- <resource path="META-INF/MANIFEST.MF">
- <filter id="924844039">
- <message_arguments>
- <message_argument value="5.1.3"/>
- <message_argument value="5.1.0"/>
- </message_arguments>
- </filter>
- </resource>
<resource path="src/org/eclipse/jgit/lib/GitmoduleEntry.java" type="org.eclipse.jgit.lib.GitmoduleEntry">
<filter id="1109393411">
<message_arguments>
@@ -24,4 +16,12 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/jgit/revwalk/DepthWalk.java" type="org.eclipse.jgit.revwalk.DepthWalk">
+ <filter id="404000815">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.revwalk.DepthWalk"/>
+ <message_argument value="getDeepenSince()"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
diff --git a/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs
index 13c32a6..ef6f5e7 100644
--- a/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs
@@ -91,7 +91,7 @@
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
diff --git a/org.eclipse.jgit/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.jgit/.settings/org.eclipse.mylyn.team.ui.prefs
index 0cba949..2fca432 100644
--- a/org.eclipse.jgit/.settings/org.eclipse.mylyn.team.ui.prefs
+++ b/org.eclipse.jgit/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -1,3 +1,3 @@
#Tue Jul 19 20:11:28 CEST 2011
-commit.comment.template=${task.description} \n\nBug\: ${task.key}
+commit.comment.template=${task.description}\n\nBug\: ${task.key}
eclipse.preferences.version=1
diff --git a/org.eclipse.jgit/META-INF/MANIFEST.MF b/org.eclipse.jgit/META-INF/MANIFEST.MF
index c7fe72c..2b9ed08 100644
--- a/org.eclipse.jgit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit/META-INF/MANIFEST.MF
@@ -3,12 +3,12 @@
Bundle-Name: %plugin_name
Automatic-Module-Name: org.eclipse.jgit
Bundle-SymbolicName: org.eclipse.jgit
-Bundle-Version: 5.1.4.qualifier
+Bundle-Version: 5.2.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %provider_name
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.jgit.annotations;version="5.1.4",
- org.eclipse.jgit.api;version="5.1.4";
+Export-Package: org.eclipse.jgit.annotations;version="5.2.0",
+ org.eclipse.jgit.api;version="5.2.0";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff,
@@ -22,52 +22,52 @@
org.eclipse.jgit.submodule,
org.eclipse.jgit.transport,
org.eclipse.jgit.merge",
- org.eclipse.jgit.api.errors;version="5.1.4";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.errors",
- org.eclipse.jgit.attributes;version="5.1.4",
- org.eclipse.jgit.blame;version="5.1.4";
+ org.eclipse.jgit.api.errors;version="5.2.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.errors",
+ org.eclipse.jgit.attributes;version="5.2.0",
+ org.eclipse.jgit.blame;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff",
- org.eclipse.jgit.diff;version="5.1.4";
+ org.eclipse.jgit.diff;version="5.2.0";
uses:="org.eclipse.jgit.patch,
org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util",
- org.eclipse.jgit.dircache;version="5.1.4";
+ org.eclipse.jgit.dircache;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.util,
org.eclipse.jgit.events,
org.eclipse.jgit.attributes",
- org.eclipse.jgit.errors;version="5.1.4";
+ org.eclipse.jgit.errors;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.internal.storage.pack,
org.eclipse.jgit.transport,
org.eclipse.jgit.dircache",
- org.eclipse.jgit.events;version="5.1.4";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.fnmatch;version="5.1.4",
- org.eclipse.jgit.gitrepo;version="5.1.4";
+ org.eclipse.jgit.events;version="5.2.0";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.fnmatch;version="5.2.0",
+ org.eclipse.jgit.gitrepo;version="5.2.0";
uses:="org.eclipse.jgit.api,
org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.xml.sax.helpers,
org.xml.sax",
- org.eclipse.jgit.gitrepo.internal;version="5.1.4";x-internal:=true,
- org.eclipse.jgit.hooks;version="5.1.4";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.ignore;version="5.1.4",
- org.eclipse.jgit.ignore.internal;version="5.1.4";x-friends:="org.eclipse.jgit.test",
- org.eclipse.jgit.internal;version="5.1.4";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.test",
- org.eclipse.jgit.internal.fsck;version="5.1.4";x-friends:="org.eclipse.jgit.test",
- org.eclipse.jgit.internal.ketch;version="5.1.4";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.dfs;version="5.1.4";
+ org.eclipse.jgit.gitrepo.internal;version="5.2.0";x-internal:=true,
+ org.eclipse.jgit.hooks;version="5.2.0";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.ignore;version="5.2.0",
+ org.eclipse.jgit.ignore.internal;version="5.2.0";x-friends:="org.eclipse.jgit.test",
+ org.eclipse.jgit.internal;version="5.2.0";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.test",
+ org.eclipse.jgit.internal.fsck;version="5.2.0";x-friends:="org.eclipse.jgit.test",
+ org.eclipse.jgit.internal.ketch;version="5.2.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.storage.dfs;version="5.2.0";
x-friends:="org.eclipse.jgit.test,
org.eclipse.jgit.http.server,
org.eclipse.jgit.http.test,
org.eclipse.jgit.lfs.test",
- org.eclipse.jgit.internal.storage.file;version="5.1.4";
+ org.eclipse.jgit.internal.storage.file;version="5.2.0";
x-friends:="org.eclipse.jgit.test,
org.eclipse.jgit.junit,
org.eclipse.jgit.junit.http,
@@ -75,12 +75,13 @@
org.eclipse.jgit.lfs,
org.eclipse.jgit.pgm,
org.eclipse.jgit.pgm.test",
- org.eclipse.jgit.internal.storage.io;version="5.1.4";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.pack;version="5.1.4";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.reftable;version="5.1.4";
+ org.eclipse.jgit.internal.storage.io;version="5.2.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.storage.pack;version="5.2.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.storage.reftable;version="5.2.0";
x-friends:="org.eclipse.jgit.http.test,org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.reftree;version="5.1.4";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.lib;version="5.1.4";
+ org.eclipse.jgit.internal.storage.reftree;version="5.2.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.transport.parser;version="5.2.0",
+ org.eclipse.jgit.lib;version="5.2.0";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util,
@@ -90,33 +91,33 @@
org.eclipse.jgit.treewalk,
org.eclipse.jgit.transport,
org.eclipse.jgit.submodule",
- org.eclipse.jgit.lib.internal;version="5.1.4";x-internal:=true,
- org.eclipse.jgit.merge;version="5.1.4";
+ org.eclipse.jgit.lib.internal;version="5.2.0";x-internal:=true,
+ org.eclipse.jgit.merge;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.diff,
org.eclipse.jgit.dircache,
org.eclipse.jgit.api",
- org.eclipse.jgit.nls;version="5.1.4",
- org.eclipse.jgit.notes;version="5.1.4";
+ org.eclipse.jgit.nls;version="5.2.0",
+ org.eclipse.jgit.notes;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.merge",
- org.eclipse.jgit.patch;version="5.1.4";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.diff",
- org.eclipse.jgit.revplot;version="5.1.4";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.revwalk",
- org.eclipse.jgit.revwalk;version="5.1.4";
+ org.eclipse.jgit.patch;version="5.2.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.diff",
+ org.eclipse.jgit.revplot;version="5.2.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.revwalk",
+ org.eclipse.jgit.revwalk;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff,
org.eclipse.jgit.revwalk.filter",
- org.eclipse.jgit.revwalk.filter;version="5.1.4";uses:="org.eclipse.jgit.revwalk,org.eclipse.jgit.lib,org.eclipse.jgit.util",
- org.eclipse.jgit.storage.file;version="5.1.4";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.util",
- org.eclipse.jgit.storage.pack;version="5.1.4";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.submodule;version="5.1.4";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk.filter,org.eclipse.jgit.treewalk",
- org.eclipse.jgit.transport;version="5.1.4";
+ org.eclipse.jgit.revwalk.filter;version="5.2.0";uses:="org.eclipse.jgit.revwalk,org.eclipse.jgit.lib,org.eclipse.jgit.util",
+ org.eclipse.jgit.storage.file;version="5.2.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.util",
+ org.eclipse.jgit.storage.pack;version="5.2.0";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.submodule;version="5.2.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk.filter,org.eclipse.jgit.treewalk",
+ org.eclipse.jgit.transport;version="5.2.0";
uses:="org.eclipse.jgit.transport.resolver,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.internal.storage.pack,
@@ -128,24 +129,24 @@
org.eclipse.jgit.transport.http,
org.eclipse.jgit.errors,
org.eclipse.jgit.storage.pack",
- org.eclipse.jgit.transport.http;version="5.1.4";uses:="javax.net.ssl",
- org.eclipse.jgit.transport.resolver;version="5.1.4";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.transport",
- org.eclipse.jgit.treewalk;version="5.1.4";
+ org.eclipse.jgit.transport.http;version="5.2.0";uses:="javax.net.ssl",
+ org.eclipse.jgit.transport.resolver;version="5.2.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.transport",
+ org.eclipse.jgit.treewalk;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.attributes,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util,
org.eclipse.jgit.dircache",
- org.eclipse.jgit.treewalk.filter;version="5.1.4";uses:="org.eclipse.jgit.treewalk",
- org.eclipse.jgit.util;version="5.1.4";
+ org.eclipse.jgit.treewalk.filter;version="5.2.0";uses:="org.eclipse.jgit.treewalk",
+ org.eclipse.jgit.util;version="5.2.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.transport.http,
org.eclipse.jgit.storage.file,
org.ietf.jgss",
- org.eclipse.jgit.util.io;version="5.1.4",
- org.eclipse.jgit.util.sha1;version="5.1.4",
- org.eclipse.jgit.util.time;version="5.1.4"
+ org.eclipse.jgit.util.io;version="5.2.0",
+ org.eclipse.jgit.util.sha1;version="5.2.0",
+ org.eclipse.jgit.util.time;version="5.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
com.jcraft.jsch;version="[0.1.37,0.2.0)",
diff --git a/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
index b9ff58c..53adf99 100644
--- a/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@
Bundle-Name: org.eclipse.jgit - Sources
Bundle-SymbolicName: org.eclipse.jgit.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.1.4.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit;version="5.1.4.qualifier";roots="."
+Bundle-Version: 5.2.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit;version="5.2.0.qualifier";roots="."
diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml
index b572145..0b31c46 100644
--- a/org.eclipse.jgit/pom.xml
+++ b/org.eclipse.jgit/pom.xml
@@ -53,7 +53,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit</artifactId>
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 3f1d212..b3f7b89 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -769,7 +769,9 @@
uriNotFoundWithMessage={0} not found: {1}
URINotSupported=URI not supported: {0}
userConfigFileInvalid=User config file {0} invalid {1}
+validatingGitModules=Validating .gitmodules files
walkFailure=Walk failure.
+wantNoSpaceWithCapabilities=No space between oid and first capability in first want line
wantNotValid=want {0} not valid
weeksAgo={0} weeks ago
windowSizeMustBeLesserThanLimit=Window size must be < limit
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
index 5b84032..c6f3c67 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
@@ -42,11 +42,14 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.File;
import java.io.FileOutputStream;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
import java.nio.file.StandardCopyOption;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -258,7 +261,8 @@ private void apply(File f, FileHeader fh)
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
- try (FileWriter fw = new FileWriter(f)) {
+ try (Writer fw = new OutputStreamWriter(new FileOutputStream(f),
+ UTF_8)) {
fw.write(sb.toString());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
index 5c06bac..73af8ba 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -283,12 +283,11 @@ private FetchResult fetch(Repository clonedRepo, URIish u)
config.addURI(u);
final String dst = (bare ? Constants.R_HEADS : Constants.R_REMOTES
- + config.getName() + "/") + "*"; //$NON-NLS-1$//$NON-NLS-2$
- RefSpec refSpec = new RefSpec();
- refSpec = refSpec.setForceUpdate(true);
- refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst); //$NON-NLS-1$
+ + config.getName() + '/') + '*';
+ boolean fetchAll = cloneAllBranches || branchesToClone == null
+ || branchesToClone.isEmpty();
- config.addFetchRefSpec(refSpec);
+ config.setFetchRefSpecs(calculateRefSpecs(fetchAll, dst));
config.update(clonedRepo.getConfig());
clonedRepo.getConfig().save();
@@ -297,27 +296,25 @@ private FetchResult fetch(Repository clonedRepo, URIish u)
FetchCommand command = new FetchCommand(clonedRepo);
command.setRemote(remote);
command.setProgressMonitor(monitor);
- command.setTagOpt(TagOpt.FETCH_TAGS);
+ command.setTagOpt(fetchAll ? TagOpt.FETCH_TAGS : TagOpt.AUTO_FOLLOW);
configure(command);
- List<RefSpec> specs = calculateRefSpecs(dst);
- command.setRefSpecs(specs);
-
return command.call();
}
- private List<RefSpec> calculateRefSpecs(String dst) {
+ private List<RefSpec> calculateRefSpecs(boolean fetchAll, String dst) {
RefSpec wcrs = new RefSpec();
wcrs = wcrs.setForceUpdate(true);
- wcrs = wcrs.setSourceDestination(Constants.R_HEADS + "*", dst); //$NON-NLS-1$
+ wcrs = wcrs.setSourceDestination(Constants.R_HEADS + '*', dst);
List<RefSpec> specs = new ArrayList<>();
- if (cloneAllBranches)
- specs.add(wcrs);
- else if (branchesToClone != null
- && branchesToClone.size() > 0) {
- for (String selectedRef : branchesToClone)
- if (wcrs.matchSource(selectedRef))
+ if (!fetchAll) {
+ for (String selectedRef : branchesToClone) {
+ if (wcrs.matchSource(selectedRef)) {
specs.add(wcrs.expandFromSource(selectedRef));
+ }
+ }
+ } else {
+ specs.add(wcrs);
}
return specs;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
index 28a27a9..29a51a0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
@@ -44,6 +44,10 @@
*/
package org.eclipse.jgit.api;
+import static org.eclipse.jgit.lib.Constants.HEAD;
+import static org.eclipse.jgit.lib.Constants.R_HEADS;
+import static org.eclipse.jgit.lib.Constants.R_REMOTES;
+
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -56,7 +60,6 @@
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
@@ -113,17 +116,18 @@ public List<Ref> call() throws GitAPIException {
Collection<Ref> refs = new ArrayList<>();
// Also return HEAD if it's detached
- Ref head = repo.exactRef(Constants.HEAD);
- if (head != null && head.getLeaf().getName().equals(Constants.HEAD))
+ Ref head = repo.exactRef(HEAD);
+ if (head != null && head.getLeaf().getName().equals(HEAD)) {
refs.add(head);
+ }
if (listMode == null) {
- refs.addAll(getRefs(Constants.R_HEADS));
+ refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS));
} else if (listMode == ListMode.REMOTE) {
- refs.addAll(getRefs(Constants.R_REMOTES));
+ refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_REMOTES));
} else {
- refs.addAll(getRefs(Constants.R_HEADS));
- refs.addAll(getRefs(Constants.R_REMOTES));
+ refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS,
+ R_REMOTES));
}
resultRefs = new ArrayList<>(filterRefs(refs));
} catch (IOException e) {
@@ -185,8 +189,4 @@ public ListBranchCommand setContains(String containsCommitish) {
this.containsCommitish = containsCommitish;
return this;
}
-
- private Collection<Ref> getRefs(String prefix) throws IOException {
- return repo.getRefDatabase().getRefsByPrefix(prefix);
- }
}
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 1783c41..9653c36 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -43,6 +43,8 @@
*/
package org.eclipse.jgit.api;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
@@ -1015,8 +1017,7 @@ private RebaseResult stop(RevCommit commitToPick, RebaseResult.Status status)
df.setRepository(repo);
df.format(commitToPick.getParent(0), commitToPick);
}
- rebaseState.createFile(PATCH, new String(bos.toByteArray(),
- Constants.CHARACTER_ENCODING));
+ rebaseState.createFile(PATCH, new String(bos.toByteArray(), UTF_8));
rebaseState.createFile(STOPPED_SHA,
repo.newObjectReader()
.abbreviate(
@@ -1733,7 +1734,7 @@ private static void createFile(File parentDir, String name,
throws IOException {
File file = new File(parentDir, name);
try (FileOutputStream fos = new FileOutputStream(file)) {
- fos.write(content.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(content.getBytes(UTF_8));
fos.write('\n');
}
}
@@ -1741,7 +1742,7 @@ private static void createFile(File parentDir, String name,
private static void appendToFile(File file, String content)
throws IOException {
try (FileOutputStream fos = new FileOutputStream(file, true)) {
- fos.write(content.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(content.getBytes(UTF_8));
fos.write('\n');
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
index 244a156..f92455a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java
@@ -179,21 +179,6 @@ public Repository call() throws GitAPIException {
// Use the path as the default.
name = path;
}
- if (name.contains("/../") || name.contains("\\..\\") //$NON-NLS-1$ //$NON-NLS-2$
- || name.startsWith("../") || name.startsWith("..\\") //$NON-NLS-1$ //$NON-NLS-2$
- || name.endsWith("/..") || name.endsWith("\\..")) { //$NON-NLS-1$ //$NON-NLS-2$
- // Submodule names are used to store the submodule repositories
- // under $GIT_DIR/modules. Having ".." in submodule names makes a
- // vulnerability (CVE-2018-11235
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=535027#c0)
- // Reject the names with them. The callers need to make sure the
- // names free from these. We don't automatically replace these
- // characters or canonicalize by regarding the name as a file path.
- // Since Path class is platform dependent, we manually check '/' and
- // '\\' patterns here.
- throw new IllegalArgumentException(MessageFormat
- .format(JGitText.get().invalidNameContainsDotDot, name));
- }
try {
SubmoduleValidator.assertValidSubmoduleName(name);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java
index 19c916f..6196e75 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java
@@ -44,6 +44,8 @@
package org.eclipse.jgit.dircache;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
@@ -75,7 +77,7 @@
public class DirCacheIterator extends AbstractTreeIterator {
/** Byte array holding ".gitattributes" string */
private static final byte[] DOT_GIT_ATTRIBUTES_BYTES = Constants.DOT_GIT_ATTRIBUTES
- .getBytes();
+ .getBytes(UTF_8);
/** The cache this iterator was created to walk. */
protected final DirCache cache;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java b/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java
index 9fbcc4d..afd7889 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java
@@ -94,7 +94,8 @@ public boolean isEmpty() {
*
* @return the set
*/
- public @NonNull Collection<String> getModified() {
+ @NonNull
+ public Collection<String> getModified() {
Collection<String> result = modified;
if (result == null) {
result = Collections.emptyList();
@@ -109,7 +110,8 @@ public boolean isEmpty() {
*
* @return the set
*/
- public @NonNull Collection<String> getDeleted() {
+ @NonNull
+ public Collection<String> getDeleted() {
Collection<String> result = deleted;
if (result == null) {
result = Collections.emptyList();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java
index 26e783d..8e46341 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java
@@ -358,7 +358,8 @@ public List<RepoProject> getProjects() {
*
* @return filtered projects list reference, never null
*/
- public @NonNull List<RepoProject> getFilteredProjects() {
+ @NonNull
+ public List<RepoProject> getFilteredProjects() {
return filteredProjects;
}
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 45a239d..5a73cdc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
@@ -42,6 +42,7 @@
*/
package org.eclipse.jgit.gitrepo;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
import static org.eclipse.jgit.lib.Constants.R_REMOTES;
@@ -606,8 +607,7 @@ public RevCommit call() throws GitAPIException {
}
objectId = inserter.insert(Constants.OBJ_BLOB,
- link.getBytes(
- Constants.CHARACTER_ENCODING));
+ link.getBytes(UTF_8));
dcEntry = new DirCacheEntry(linkfile.dest);
dcEntry.setObjectId(objectId);
dcEntry.setFileMode(FileMode.SYMLINK);
@@ -620,7 +620,7 @@ public RevCommit call() throws GitAPIException {
// create a new DirCacheEntry for .gitmodules file.
final DirCacheEntry dcEntry = new DirCacheEntry(Constants.DOT_GIT_MODULES);
ObjectId objectId = inserter.insert(Constants.OBJ_BLOB,
- content.getBytes(Constants.CHARACTER_ENCODING));
+ content.getBytes(UTF_8));
dcEntry.setObjectId(objectId);
dcEntry.setFileMode(FileMode.REGULAR_FILE);
builder.add(dcEntry);
@@ -629,7 +629,7 @@ public RevCommit call() throws GitAPIException {
// create a new DirCacheEntry for .gitattributes file.
final DirCacheEntry dcEntryAttr = new DirCacheEntry(Constants.DOT_GIT_ATTRIBUTES);
ObjectId attrId = inserter.insert(Constants.OBJ_BLOB,
- attributes.toString().getBytes(Constants.CHARACTER_ENCODING));
+ attributes.toString().getBytes(UTF_8));
dcEntryAttr.setObjectId(attrId);
dcEntryAttr.setFileMode(FileMode.REGULAR_FILE);
builder.add(dcEntryAttr);
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 c11ae5a..9f0e3e0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -830,7 +830,9 @@ public static JGitText get() {
/***/ public String uriNotFoundWithMessage;
/***/ public String URINotSupported;
/***/ public String userConfigFileInvalid;
+ /***/ public String validatingGitModules;
/***/ public String walkFailure;
+ /***/ public String wantNoSpaceWithCapabilities;
/***/ public String wantNotValid;
/***/ public String weeksAgo;
/***/ public String windowSizeMustBeLesserThanLimit;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java
index 131b004..335ac66 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java
@@ -61,20 +61,21 @@ public static class CorruptObject {
final int type;
- ObjectChecker.ErrorType errorType;
+ @Nullable
+ final ObjectChecker.ErrorType errorType;
/**
* @param id
* the object identifier.
* @param type
* type of the object.
+ * @param errorType
+ * kind of error
*/
- public CorruptObject(ObjectId id, int type) {
+ public CorruptObject(ObjectId id, int type,
+ @Nullable ObjectChecker.ErrorType errorType) {
this.id = id;
this.type = type;
- }
-
- void setErrorType(ObjectChecker.ErrorType errorType) {
this.errorType = errorType;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java
index 5397ba4..50594df 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckPackParser.java
@@ -174,12 +174,8 @@ protected void verifySafeObject(final AnyObjectId id, final int type,
try {
super.verifySafeObject(id, type, data);
} catch (CorruptObjectException e) {
- // catch the exception and continue parse the pack file
- CorruptObject o = new CorruptObject(id.toObjectId(), type);
- if (e.getErrorType() != null) {
- o.setErrorType(e.getErrorType());
- }
- corruptObjects.add(o);
+ corruptObjects.add(
+ new CorruptObject(id.toObjectId(), type, e.getErrorType()));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsFsck.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsFsck.java
index 3f96d09..c0e24c0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsFsck.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsFsck.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.internal.storage.dfs;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK;
@@ -54,12 +55,18 @@
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.fsck.FsckError;
import org.eclipse.jgit.internal.fsck.FsckError.CorruptIndex;
+import org.eclipse.jgit.internal.fsck.FsckError.CorruptObject;
import org.eclipse.jgit.internal.fsck.FsckPackParser;
import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
+import org.eclipse.jgit.internal.submodule.SubmoduleValidator;
+import org.eclipse.jgit.internal.submodule.SubmoduleValidator.SubmoduleValidationException;
+import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.GitmoduleEntry;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectChecker;
import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.revwalk.ObjectWalk;
@@ -102,6 +109,7 @@ public FsckError check(ProgressMonitor pm) throws IOException {
FsckError errors = new FsckError();
if (!connectivityOnly) {
+ objChecker.reset();
checkPacks(pm, errors);
}
checkConnectivity(pm, errors);
@@ -128,6 +136,8 @@ private void checkPacks(ProgressMonitor pm, FsckError errors)
}
}
}
+
+ checkGitModules(pm, errors);
}
private void verifyPack(ProgressMonitor pm, FsckError errors, DfsReader ctx,
@@ -142,6 +152,28 @@ private void verifyPack(ProgressMonitor pm, FsckError errors, DfsReader ctx,
fpp.verifyIndex(pack.getPackIndex(ctx));
}
+ private void checkGitModules(ProgressMonitor pm, FsckError errors)
+ throws IOException {
+ pm.beginTask(JGitText.get().validatingGitModules,
+ objChecker.getGitsubmodules().size());
+ for (GitmoduleEntry entry : objChecker.getGitsubmodules()) {
+ AnyObjectId blobId = entry.getBlobId();
+ ObjectLoader blob = objdb.open(blobId, Constants.OBJ_BLOB);
+
+ try {
+ SubmoduleValidator.assertValidGitModulesFile(
+ new String(blob.getBytes(), UTF_8));
+ } catch (SubmoduleValidationException e) {
+ CorruptObject co = new FsckError.CorruptObject(
+ blobId.toObjectId(), Constants.OBJ_BLOB,
+ e.getFsckMessageId());
+ errors.getCorruptObjects().add(co);
+ }
+ pm.update(1);
+ }
+ pm.endTask();
+ }
+
private void checkConnectivity(ProgressMonitor pm, FsckError errors)
throws IOException {
pm.beginTask(JGitText.get().countingObjects, ProgressMonitor.UNKNOWN);
@@ -179,6 +211,9 @@ private void checkConnectivity(ProgressMonitor pm, FsckError errors)
* Use a customized object checker instead of the default one. Caller can
* specify a skip list to ignore some errors.
*
+ * It will be reset at the start of each {{@link #check(ProgressMonitor)}
+ * call.
+ *
* @param objChecker
* A customized object checker.
*/
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
index 24723d8..4d5c1c0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.internal.storage.file;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK;
@@ -50,7 +51,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
import java.nio.file.AtomicMoveNotSupportedException;
import java.nio.file.Files;
@@ -1034,8 +1034,8 @@ Set<AlternateHandle.Id> addMe(Set<AlternateHandle.Id> skips) {
}
private static BufferedReader open(File f)
- throws FileNotFoundException {
- return new BufferedReader(new FileReader(f));
+ throws IOException, FileNotFoundException {
+ return Files.newBufferedReader(f.toPath(), UTF_8);
}
private AlternateHandle openAlternate(String location)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java
index 7069588..964cc4d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java
@@ -207,7 +207,7 @@ public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
}
/** An entry in the old PackBitmapIndex. */
- public final class Entry extends ObjectId {
+ public static final class Entry extends ObjectId {
private final int flags;
Entry(AnyObjectId src, int flags) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackOutputStream.java
index 7f38a7b..eb777be 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackOutputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackOutputStream.java
@@ -187,6 +187,7 @@ public final void writeObject(ObjectToPack otp) throws IOException {
* @throws java.io.IOException
* the underlying stream refused to accept the header.
*/
+ @SuppressWarnings("ShortCircuitBoolean")
public final void writeHeader(ObjectToPack otp, long rawLength)
throws IOException {
ObjectToPack b = otp.getDeltaBase();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java
index 3651631..7b872b1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/submodule/SubmoduleValidator.java
@@ -45,13 +45,17 @@
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PATH;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_URL;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_SUBMODULE_SECTION;
+import static org.eclipse.jgit.lib.ObjectChecker.ErrorType.GITMODULES_NAME;
+import static org.eclipse.jgit.lib.ObjectChecker.ErrorType.GITMODULES_PARSE;
+import static org.eclipse.jgit.lib.ObjectChecker.ErrorType.GITMODULES_PATH;
+import static org.eclipse.jgit.lib.ObjectChecker.ErrorType.GITMODULES_URL;
-import java.io.IOException;
import java.text.MessageFormat;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Config;
+import org.eclipse.jgit.lib.ObjectChecker;
/**
* Validations for the git submodule fields (name, path, uri).
@@ -66,15 +70,30 @@ public class SubmoduleValidator {
*/
public static class SubmoduleValidationException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ private final ObjectChecker.ErrorType fsckMessageId;
+
/**
* @param message
* Description of the problem
+ * @param fsckMessageId
+ * Error identifier, following the git fsck fsck.<msg-id>
+ * format
*/
- public SubmoduleValidationException(String message) {
+ SubmoduleValidationException(String message,
+ ObjectChecker.ErrorType fsckMessageId) {
super(message);
+ this.fsckMessageId = fsckMessageId;
}
- private static final long serialVersionUID = 1L;
+
+ /**
+ * @return the error identifier
+ */
+ public ObjectChecker.ErrorType getFsckMessageId() {
+ return fsckMessageId;
+ }
}
/**
@@ -100,13 +119,15 @@ public static void assertValidSubmoduleName(String name)
// Since Path class is platform dependent, we manually check '/' and
// '\\' patterns here.
throw new SubmoduleValidationException(MessageFormat
- .format(JGitText.get().invalidNameContainsDotDot, name));
+ .format(JGitText.get().invalidNameContainsDotDot, name),
+ GITMODULES_NAME);
}
if (name.startsWith("-")) { //$NON-NLS-1$
throw new SubmoduleValidationException(
MessageFormat.format(
- JGitText.get().submoduleNameInvalid, name));
+ JGitText.get().submoduleNameInvalid, name),
+ GITMODULES_NAME);
}
}
@@ -123,7 +144,8 @@ public static void assertValidSubmoduleUri(String uri)
if (uri.startsWith("-")) { //$NON-NLS-1$
throw new SubmoduleValidationException(
MessageFormat.format(
- JGitText.get().submoduleUrlInvalid, uri));
+ JGitText.get().submoduleUrlInvalid, uri),
+ GITMODULES_URL);
}
}
@@ -140,19 +162,22 @@ public static void assertValidSubmodulePath(String path)
if (path.startsWith("-")) { //$NON-NLS-1$
throw new SubmoduleValidationException(
MessageFormat.format(
- JGitText.get().submodulePathInvalid, path));
+ JGitText.get().submodulePathInvalid, path),
+ GITMODULES_PATH);
}
}
/**
+ * Validate a .gitmodules file
+ *
* @param gitModulesContents
* Contents of a .gitmodule file. They will be parsed internally.
- * @throws IOException
- * If the contents
+ * @throws SubmoduleValidationException
+ * if the contents don't look like a configuration file or field
+ * values are not valid
*/
public static void assertValidGitModulesFile(String gitModulesContents)
- throws IOException {
- // Validate .gitmodules file
+ throws SubmoduleValidationException {
Config c = new Config();
try {
c.fromText(gitModulesContents);
@@ -173,12 +198,9 @@ public static void assertValidGitModulesFile(String gitModulesContents)
}
}
} catch (ConfigInvalidException e) {
- throw new IOException(
- MessageFormat.format(
- JGitText.get().invalidGitModules,
- e));
- } catch (SubmoduleValidationException e) {
- throw new IOException(e.getMessage(), e);
+ throw new SubmoduleValidationException(
+ JGitText.get().invalidGitModules,
+ GITMODULES_PARSE);
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/parser/FirstWant.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/parser/FirstWant.java
new file mode 100644
index 0000000..1ac9b18
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/parser/FirstWant.java
@@ -0,0 +1,120 @@
+/*
+ * 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.internal.transport.parser;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jgit.errors.PackProtocolException;
+import org.eclipse.jgit.internal.JGitText;
+
+/**
+ * In the pack negotiation phase (protocol v0/v1), the client sends a list of
+ * wants. The first "want" line is special, as it (can) have a list of
+ * capabilities appended.
+ *
+ * E.g. "want oid cap1 cap2 cap3"
+ *
+ * Do not confuse this line with the first one in the reference advertisement,
+ * which is sent by the server, looks like
+ * "b8f7c471373b8583ced0025cfad8c9916c484b76 HEAD\0 cap1 cap2 cap3" and is
+ * parsed by the BasePackConnection.readAdvertisedRefs method.
+ *
+ * This class parses the input want line and holds the results: the actual want
+ * line and the capabilities.
+ *
+ * @since 5.2
+ */
+public class FirstWant {
+ private final String line;
+
+ private final Set<String> capabilities;
+
+ /**
+ * Parse the first want line in the protocol v0/v1 pack negotiation.
+ *
+ * @param line
+ * line from the client.
+ * @return an instance of FirstWant
+ * @throws PackProtocolException
+ * if the line doesn't follow the protocol format.
+ */
+ public static FirstWant fromLine(String line) throws PackProtocolException {
+ String wantLine;
+ Set<String> capabilities;
+
+ if (line.length() > 45) {
+ String opt = line.substring(45);
+ if (!opt.startsWith(" ")) { //$NON-NLS-1$
+ throw new PackProtocolException(JGitText.get().wantNoSpaceWithCapabilities);
+ }
+ opt = opt.substring(1);
+ HashSet<String> opts = new HashSet<>(
+ Arrays.asList(opt.split(" "))); //$NON-NLS-1$
+ wantLine = line.substring(0, 45);
+ capabilities = Collections.unmodifiableSet(opts);
+ } else {
+ wantLine = line;
+ capabilities = Collections.emptySet();
+ }
+
+ return new FirstWant(wantLine, capabilities);
+ }
+
+ private FirstWant(String line, Set<String> capabilities) {
+ this.line = line;
+ this.capabilities = capabilities;
+ }
+
+ /** @return non-capabilities part of the line. */
+ public String getLine() {
+ return line;
+ }
+
+ /** @return capabilities parsed from the line as an immutable set. */
+ public Set<String> getCapabilities() {
+ return capabilities;
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
index b666f21..4726975 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
@@ -62,7 +62,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.events.ConfigChangedEvent;
import org.eclipse.jgit.events.ConfigChangedListener;
@@ -868,7 +867,7 @@ private ConfigSnapshot unsetSection(final ConfigSnapshot srcState,
boolean lastWasMatch = false;
for (ConfigLine e : srcState.entryList) {
- if (e.match(section, subsection)) {
+ if (e.includedFrom == null && e.match(section, subsection)) {
// Skip this record, it's for the section we are removing.
lastWasMatch = true;
continue;
@@ -923,7 +922,7 @@ private ConfigSnapshot replaceStringList(final ConfigSnapshot srcState,
//
while (entryIndex < entries.size() && valueIndex < values.size()) {
final ConfigLine e = entries.get(entryIndex);
- if (e.match(section, subsection, name)) {
+ if (e.includedFrom == null && e.match(section, subsection, name)) {
entries.set(entryIndex, e.forValue(values.get(valueIndex++)));
insertPosition = entryIndex + 1;
}
@@ -935,7 +934,8 @@ private ConfigSnapshot replaceStringList(final ConfigSnapshot srcState,
if (valueIndex == values.size() && entryIndex < entries.size()) {
while (entryIndex < entries.size()) {
final ConfigLine e = entries.get(entryIndex++);
- if (e.match(section, subsection, name))
+ if (e.includedFrom == null
+ && e.match(section, subsection, name))
entries.remove(--entryIndex);
}
}
@@ -948,7 +948,8 @@ private ConfigSnapshot replaceStringList(final ConfigSnapshot srcState,
// is already a section available that matches. Insert
// after the last key of that section.
//
- insertPosition = findSectionEnd(entries, section, subsection);
+ insertPosition = findSectionEnd(entries, section, subsection,
+ true);
}
if (insertPosition < 0) {
// We didn't find any matching section header for this key,
@@ -985,9 +986,14 @@ private static List<ConfigLine> copy(final ConfigSnapshot src,
}
private static int findSectionEnd(final List<ConfigLine> entries,
- final String section, final String subsection) {
+ final String section, final String subsection,
+ boolean skipIncludedLines) {
for (int i = 0; i < entries.size(); i++) {
ConfigLine e = entries.get(i);
+ if (e.includedFrom != null && skipIncludedLines) {
+ continue;
+ }
+
if (e.match(section, subsection, null)) {
i++;
while (i < entries.size()) {
@@ -1011,6 +1017,8 @@ private static int findSectionEnd(final List<ConfigLine> entries,
public String toText() {
final StringBuilder out = new StringBuilder();
for (ConfigLine e : state.get().entryList) {
+ if (e.includedFrom != null)
+ continue;
if (e.prefix != null)
out.append(e.prefix);
if (e.section != null && e.name == null) {
@@ -1060,11 +1068,11 @@ public String toText() {
* made to {@code this}.
*/
public void fromText(String text) throws ConfigInvalidException {
- state.set(newState(fromTextRecurse(text, 1)));
+ state.set(newState(fromTextRecurse(text, 1, null)));
}
- private List<ConfigLine> fromTextRecurse(String text, int depth)
- throws ConfigInvalidException {
+ private List<ConfigLine> fromTextRecurse(String text, int depth,
+ String includedFrom) throws ConfigInvalidException {
if (depth > MAX_DEPTH) {
throw new ConfigInvalidException(
JGitText.get().tooManyIncludeRecursions);
@@ -1073,6 +1081,7 @@ private List<ConfigLine> fromTextRecurse(String text, int depth)
final StringReader in = new StringReader(text);
ConfigLine last = null;
ConfigLine e = new ConfigLine();
+ e.includedFrom = includedFrom;
for (;;) {
int input = in.read();
if (-1 == input) {
@@ -1088,7 +1097,7 @@ private List<ConfigLine> fromTextRecurse(String text, int depth)
if (e.section != null)
last = e;
e = new ConfigLine();
-
+ e.includedFrom = includedFrom;
} else if (e.suffix != null) {
// Everything up until the end-of-line is in the suffix.
e.suffix += c;
@@ -1148,7 +1157,6 @@ private List<ConfigLine> fromTextRecurse(String text, int depth)
* if something went wrong while reading the config
* @since 4.10
*/
- @Nullable
protected byte[] readIncludedConfig(String relPath)
throws ConfigInvalidException {
return null;
@@ -1173,7 +1181,7 @@ private void addIncludedConfig(final List<ConfigLine> newEntries,
decoded = RawParseUtils.decode(bytes);
}
try {
- newEntries.addAll(fromTextRecurse(decoded, depth + 1));
+ newEntries.addAll(fromTextRecurse(decoded, depth + 1, line.value));
} catch (ConfigInvalidException e) {
throw new ConfigInvalidException(MessageFormat
.format(JGitText.get().cannotReadFile, line.value), e);
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 d4a0280..196ce64 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -432,4 +432,18 @@ public final class ConfigConstants {
* @since 4.11
*/
public static final String CONFIG_SECTION_LFS = "lfs";
+
+ /**
+ * The "i18n" section
+ *
+ * @since 5.2
+ */
+ public static final String CONFIG_SECTION_I18N = "i18n";
+
+ /**
+ * The "logOutputEncoding" key
+ *
+ * @since 5.2
+ */
+ public static final String CONFIG_KEY_LOG_OUTPUT_ENCODING = "logOutputEncoding";
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java
index 937ba92..e623a8c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigLine.java
@@ -73,6 +73,9 @@ class ConfigLine {
/** The text content after entry. */
String suffix;
+ /** The source from which this line was included from. */
+ String includedFrom;
+
ConfigLine forValue(String newValue) {
final ConfigLine e = new ConfigLine();
e.prefix = prefix;
@@ -81,6 +84,7 @@ ConfigLine forValue(String newValue) {
e.name = name;
e.value = newValue;
e.suffix = suffix;
+ e.includedFrom = includedFrom;
return e;
}
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 ed00554..4c55196 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
@@ -232,11 +232,17 @@ public final class Constants {
*
* @deprecated Use {@link java.nio.charset.StandardCharsets#UTF_8} directly
* instead.
- **/
+ */
@Deprecated
public static final Charset CHARSET;
- /** Native character encoding for commit messages, file names... */
+ /**
+ * Native character encoding for commit messages, file names...
+ *
+ * @deprecated Use {@link java.nio.charset.StandardCharsets#UTF_8} directly
+ * instead.
+ */
+ @Deprecated
public static final String CHARACTER_ENCODING;
/** Default main branch name */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java
index 891c7f2..6a66cf6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java
@@ -293,7 +293,8 @@ private static IllegalArgumentException notTimeUnit(String section,
/** {@inheritDoc} */
@Override
- public @NonNull List<RefSpec> getRefSpecs(Config config, String section,
+ @NonNull
+ public List<RefSpec> getRefSpecs(Config config, String section,
String subsection, String name) {
String[] values = config.getStringList(section, subsection, name);
List<RefSpec> result = new ArrayList<>(values.length);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
index d37fb21..127f019 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
@@ -109,7 +109,8 @@
* the caller can provide both of these validations on its own.
* <p>
* Instances of this class are not thread safe, but they may be reused to
- * perform multiple object validations.
+ * perform multiple object validations, calling {@link #reset()} between them to
+ * clear the internal state (e.g. {@link #getGitsubmodules()})
*/
public class ObjectChecker {
/** Header "tree " */
@@ -173,6 +174,13 @@ public enum ErrorType {
/***/ BAD_TIMEZONE,
/***/ MISSING_EMAIL,
/***/ MISSING_SPACE_BEFORE_DATE,
+ /** @since 5.2 */ GITMODULES_BLOB,
+ /** @since 5.2 */ GITMODULES_LARGE,
+ /** @since 5.2 */ GITMODULES_NAME,
+ /** @since 5.2 */ GITMODULES_PARSE,
+ /** @since 5.2 */ GITMODULES_PATH,
+ /** @since 5.2 */ GITMODULES_SYMLINK,
+ /** @since 5.2 */ GITMODULES_URL,
/***/ UNKNOWN_TYPE,
// These are unique to JGit.
@@ -1251,4 +1259,19 @@ private String normalize(byte[] raw, int ptr, int end) {
public List<GitmoduleEntry> getGitsubmodules() {
return gitsubmodules;
}
+
+ /**
+ * Reset the invocation-specific state from this instance. Specifically this
+ * clears the list of .gitmodules files encountered (see
+ * {@link #getGitsubmodules()})
+ *
+ * Configurations like errors to filter, skip lists or the specified O.S.
+ * (set via {@link #setSafeForMacOS(boolean)} or
+ * {@link #setSafeForWindows(boolean)}) are NOT cleared.
+ *
+ * @since 5.2
+ */
+ public void reset() {
+ gitsubmodules.clear();
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
index 3170787..68929b4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java
@@ -415,6 +415,31 @@ public List<Ref> getRefsByPrefix(String prefix) throws IOException {
}
/**
+ * Returns refs whose names start with one of the given prefixes.
+ * <p>
+ * The default implementation uses {@link #getRefsByPrefix(String)}.
+ * Implementors of {@link RefDatabase} should override this method directly
+ * if a better implementation is possible.
+ *
+ * @param prefixes
+ * strings that names of refs should start with.
+ * @return immutable list of refs whose names start with one of
+ * {@code prefixes}. Refs can be unsorted and may contain duplicates
+ * if the prefixes overlap.
+ * @throws java.io.IOException
+ * the reference space cannot be accessed.
+ * @since 5.2
+ */
+ @NonNull
+ public List<Ref> getRefsByPrefix(String... prefixes) throws IOException {
+ List<Ref> result = new ArrayList<>();
+ for (String prefix : prefixes) {
+ result.addAll(getRefsByPrefix(prefix));
+ }
+ return Collections.unmodifiableList(result);
+ }
+
+ /**
* Check if any refs exist in the ref database.
* <p>
* This uses the same definition of refs as {@link #getRefs()}. In
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
index 5cd593e..fc3ea84 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
@@ -823,7 +823,7 @@ private static RevObject safeParseOld(RevWalk rw, AnyObjectId oldId)
* Handle the abstraction of storing a ref update. This is because both
* updating and deleting of a ref have merge testing in common.
*/
- private abstract class Store {
+ private static abstract class Store {
abstract Result execute(Result status) throws IOException;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
index d73c05e..77d268a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -49,6 +49,7 @@
package org.eclipse.jgit.lib;
import static org.eclipse.jgit.lib.Constants.LOCK_SUFFIX;
+import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -1965,7 +1966,7 @@ private String readCommitMsgFile(String msgFilename) throws IOException {
private void writeCommitMsg(File msgFile, String msg) throws IOException {
if (msg != null) {
try (FileOutputStream fos = new FileOutputStream(msgFile)) {
- fos.write(msg.getBytes(Constants.CHARACTER_ENCODING));
+ fos.write(msg.getBytes(UTF_8));
}
} else {
FileUtils.delete(msgFile, FileUtils.SKIP_MISSING);
@@ -1980,7 +1981,6 @@ private void writeCommitMsg(File msgFile, String msg) throws IOException {
* empty
* @throws IOException
*/
- @Nullable
private byte[] readGitDirectoryFile(String filename) throws IOException {
File file = new File(getDirectory(), filename);
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
index 036917e..4796708 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
@@ -45,6 +45,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
@@ -63,7 +64,7 @@ public class MergeFormatter {
* that are LF-separated lines.
*
* @param out
- * the outputstream where to write the textual presentation
+ * the output stream where to write the textual presentation
* @param res
* the merge result which should be presented
* @param seqName
@@ -72,13 +73,44 @@ public class MergeFormatter {
* " or ">>>>>>> " conflict markers. The
* names for the sequences are given in this list
* @param charsetName
- * the name of the characterSet used when writing conflict
+ * the name of the character set used when writing conflict
* metadata
* @throws java.io.IOException
+ * @deprecated Use
+ * {@link #formatMerge(OutputStream, MergeResult, List, Charset)}
+ * instead.
*/
+ @Deprecated
public void formatMerge(OutputStream out, MergeResult<RawText> res,
List<String> seqName, String charsetName) throws IOException {
- new MergeFormatterPass(out, res, seqName, charsetName).formatMerge();
+ formatMerge(out, res, seqName, Charset.forName(charsetName));
+ }
+
+ /**
+ * Formats the results of a merge of {@link org.eclipse.jgit.diff.RawText}
+ * objects in a Git conformant way. This method also assumes that the
+ * {@link org.eclipse.jgit.diff.RawText} objects being merged are line
+ * oriented files which use LF as delimiter. This method will also use LF to
+ * separate chunks and conflict metadata, therefore it fits only to texts
+ * that are LF-separated lines.
+ *
+ * @param out
+ * the output stream where to write the textual presentation
+ * @param res
+ * the merge result which should be presented
+ * @param seqName
+ * When a conflict is reported each conflicting range will get a
+ * name. This name is following the "<<<<<<<
+ * " or ">>>>>>> " conflict markers. The
+ * names for the sequences are given in this list
+ * @param charset
+ * the character set used when writing conflict metadata
+ * @throws java.io.IOException
+ * @since 5.2
+ */
+ public void formatMerge(OutputStream out, MergeResult<RawText> res,
+ List<String> seqName, Charset charset) throws IOException {
+ new MergeFormatterPass(out, res, seqName, charset).formatMerge();
}
/**
@@ -100,17 +132,51 @@ public void formatMerge(OutputStream out, MergeResult<RawText> res,
* @param theirsName
* the name ranges from theirs should get
* @param charsetName
- * the name of the characterSet used when writing conflict
+ * the name of the character set used when writing conflict
* metadata
* @throws java.io.IOException
+ * @deprecated use
+ * {@link #formatMerge(OutputStream, MergeResult, String, String, String, Charset)}
+ * instead.
+ */
+ @Deprecated
+ public void formatMerge(OutputStream out, MergeResult res, String baseName,
+ String oursName, String theirsName, String charsetName) throws IOException {
+ formatMerge(out, res, baseName, oursName, theirsName,
+ Charset.forName(charsetName));
+ }
+
+ /**
+ * Formats the results of a merge of exactly two
+ * {@link org.eclipse.jgit.diff.RawText} objects in a Git conformant way.
+ * This convenience method accepts the names for the three sequences (base
+ * and the two merged sequences) as explicit parameters and doesn't require
+ * the caller to specify a List
+ *
+ * @param out
+ * the {@link java.io.OutputStream} where to write the textual
+ * presentation
+ * @param res
+ * the merge result which should be presented
+ * @param baseName
+ * the name ranges from the base should get
+ * @param oursName
+ * the name ranges from ours should get
+ * @param theirsName
+ * the name ranges from theirs should get
+ * @param charset
+ * the character set used when writing conflict metadata
+ * @throws java.io.IOException
+ * @since 5.2
*/
@SuppressWarnings("unchecked")
public void formatMerge(OutputStream out, MergeResult res, String baseName,
- String oursName, String theirsName, String charsetName) throws IOException {
+ String oursName, String theirsName, Charset charset)
+ throws IOException {
List<String> names = new ArrayList<>(3);
names.add(baseName);
names.add(oursName);
names.add(theirsName);
- formatMerge(out, res, names, charsetName);
+ formatMerge(out, res, names, charset);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatterPass.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatterPass.java
index 060f068..e1a8d31 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatterPass.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatterPass.java
@@ -46,6 +46,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.Charset;
import java.util.List;
import org.eclipse.jgit.diff.RawText;
@@ -59,19 +60,33 @@ class MergeFormatterPass {
private final List<String> seqName;
- private final String charsetName;
+ private final Charset charset;
private final boolean threeWayMerge;
private String lastConflictingName; // is set to non-null whenever we are in
// a conflict
- MergeFormatterPass(OutputStream out, MergeResult<RawText> res, List<String> seqName,
- String charsetName) {
+ /**
+ * @param out
+ * the {@link java.io.OutputStream} where to write the textual
+ * presentation
+ * @param res
+ * the merge result which should be presented
+ * @param seqName
+ * When a conflict is reported each conflicting range will get a
+ * name. This name is following the "<<<<<<<
+ * " or ">>>>>>> " conflict markers. The
+ * names for the sequences are given in this list
+ * @param charset
+ * the character set used when writing conflict metadata
+ */
+ MergeFormatterPass(OutputStream out, MergeResult<RawText> res,
+ List<String> seqName, Charset charset) {
this.out = new EolAwareOutputStream(out);
this.res = res;
this.seqName = seqName;
- this.charsetName = charsetName;
+ this.charset = charset;
this.threeWayMerge = (res.getSequences().size() == 3);
}
@@ -133,7 +148,7 @@ private void writeConflictChange(MergeChunk chunk) throws IOException {
private void writeln(String s) throws IOException {
out.beginln();
- out.write((s + "\n").getBytes(charsetName)); //$NON-NLS-1$
+ out.write((s + "\n").getBytes(charset)); //$NON-NLS-1$
}
private void writeLine(RawText seq, int i) throws IOException {
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 f60c95f..412d9bb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -46,10 +46,10 @@
*/
package org.eclipse.jgit.merge;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.diff.DiffAlgorithm.SupportedAlgorithm.HISTOGRAM;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_DIFF_SECTION;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_ALGORITHM;
-import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
import java.io.BufferedOutputStream;
@@ -1026,7 +1026,7 @@ private TemporaryBuffer doMerge(MergeResult<RawText> result)
db != null ? nonNullRepo().getDirectory() : null, inCoreLimit);
try {
new MergeFormatter().formatMerge(buf, result,
- Arrays.asList(commitNames), CHARACTER_ENCODING);
+ Arrays.asList(commitNames), UTF_8);
buf.close();
} catch (IOException e) {
buf.destroy();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java
index eaec305..6c6cc95 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java
@@ -59,6 +59,8 @@ class DepthGenerator extends Generator {
private final int depth;
+ private final int deepenSince;
+
private final RevWalk walk;
/**
@@ -91,6 +93,7 @@ class DepthGenerator extends Generator {
walk = (RevWalk)w;
this.depth = w.getDepth();
+ this.deepenSince = w.getDeepenSince();
this.UNSHALLOW = w.getUnshallowFlag();
this.REINTERESTING = w.getReinterestingFlag();
@@ -142,12 +145,24 @@ RevCommit next() throws MissingObjectException,
// this depth is guaranteed to be the smallest value that
// any path could produce.
if (dp.depth == -1) {
+ boolean failsDeepenSince = false;
+ if (deepenSince != 0) {
+ if ((p.flags & RevWalk.PARSED) == 0) {
+ p.parseHeaders(walk);
+ }
+ failsDeepenSince =
+ p.getCommitTime() < deepenSince;
+ }
+
dp.depth = newDepth;
// If the parent is not too deep, add it to the queue
// so that we can produce it later
- if (newDepth <= depth)
+ if (newDepth <= depth && !failsDeepenSince) {
pending.add(p);
+ } else {
+ c.isBoundary = true;
+ }
}
// If the current commit has become unshallowed, everything
@@ -160,8 +175,7 @@ RevCommit next() throws MissingObjectException,
}
}
- // Produce all commits less than the depth cutoff
- boolean produce = c.depth <= depth;
+ boolean produce = true;
// Unshallow commits are uninteresting, but still need to be sent
// up to the PackWriter so that it will exclude objects correctly.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java
index 06a5272..3499572 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthWalk.java
@@ -63,6 +63,15 @@ public interface DepthWalk {
*/
public int getDepth();
+ /**
+ * @return the deepen-since value; if not 0, this walk only returns commits
+ * whose commit time is at or after this limit
+ * @since 5.2
+ */
+ public default int getDeepenSince() {
+ return 0;
+ }
+
/** @return flag marking commits that should become unshallow. */
/**
* Get flag marking commits that should become unshallow.
@@ -83,12 +92,23 @@ public static class Commit extends RevCommit {
/** Depth of this commit in the graph, via shortest path. */
int depth;
+ boolean isBoundary;
+
/** @return depth of this commit, as found by the shortest path. */
public int getDepth() {
return depth;
}
/**
+ * @return true if at least one of this commit's children was excluded
+ * due to a depth or shallow-since restriction, false otherwise
+ * @since 5.2
+ */
+ public boolean isBoundary() {
+ return isBoundary;
+ }
+
+ /**
* Initialize a new commit.
*
* @param id
@@ -104,6 +124,8 @@ protected Commit(AnyObjectId id) {
public class RevWalk extends org.eclipse.jgit.revwalk.RevWalk implements DepthWalk {
private final int depth;
+ private int deepenSince;
+
private final RevFlag UNSHALLOW;
private final RevFlag REINTERESTING;
@@ -159,6 +181,22 @@ public int getDepth() {
}
@Override
+ public int getDeepenSince() {
+ return deepenSince;
+ }
+
+ /**
+ * Sets the deepen-since value.
+ *
+ * @param limit
+ * new deepen-since value
+ * @since 5.2
+ */
+ public void setDeepenSince(int limit) {
+ deepenSince = limit;
+ }
+
+ @Override
public RevFlag getUnshallowFlag() {
return UNSHALLOW;
}
@@ -174,6 +212,7 @@ public RevFlag getReinterestingFlag() {
@Override
public ObjectWalk toObjectWalkWithSameObjects() {
ObjectWalk ow = new ObjectWalk(reader, depth);
+ ow.deepenSince = deepenSince;
ow.objects = objects;
ow.freeFlags = freeFlags;
return ow;
@@ -184,6 +223,8 @@ public ObjectWalk toObjectWalkWithSameObjects() {
public class ObjectWalk extends org.eclipse.jgit.revwalk.ObjectWalk implements DepthWalk {
private final int depth;
+ private int deepenSince;
+
private final RevFlag UNSHALLOW;
private final RevFlag REINTERESTING;
@@ -263,6 +304,11 @@ public int getDepth() {
}
@Override
+ public int getDeepenSince() {
+ return deepenSince;
+ }
+
+ @Override
public RevFlag getUnshallowFlag() {
return UNSHALLOW;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
index 86ecd8e..af4ec1f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
@@ -407,7 +407,7 @@ public final RevCommit getParent(int nth) {
* @return contents of the gpg signature; null if the commit was not signed.
* @since 5.1
*/
- public final @Nullable byte[] getRawGpgSignature() {
+ public final byte[] getRawGpgSignature() {
final byte[] raw = buffer;
final byte[] header = {'g', 'p', 'g', 's', 'i', 'g'};
final int start = RawParseUtils.headerStart(header, raw, 0);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
index 93b3baa..2b31ebd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileBasedConfig.java
@@ -57,7 +57,6 @@
import java.io.IOException;
import java.text.MessageFormat;
-import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.errors.LockFailedException;
import org.eclipse.jgit.internal.JGitText;
@@ -281,7 +280,6 @@ public boolean isOutdated() {
* @since 4.10
*/
@Override
- @Nullable
protected byte[] readIncludedConfig(String relPath)
throws ConfigInvalidException {
final File file;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index f6ec4b9..c5661e5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -542,7 +542,7 @@ IOException error(final String action, final String key,
}
buf = b.toByteArray();
if (buf.length > 0) {
- err.initCause(new IOException("\n" + new String(buf))); //$NON-NLS-1$
+ err.initCause(new IOException("\n" + new String(buf, UTF_8))); //$NON-NLS-1$
}
}
return err;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
index d3419bc..0376336 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
@@ -72,12 +72,14 @@
import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.errors.InvalidObjectIdException;
+import org.eclipse.jgit.errors.LargeObjectException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.TooLargePackException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.PackLock;
import org.eclipse.jgit.internal.submodule.SubmoduleValidator;
+import org.eclipse.jgit.internal.submodule.SubmoduleValidator.SubmoduleValidationException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.BatchRefUpdate;
import org.eclipse.jgit.lib.Config;
@@ -1528,8 +1530,12 @@ private void checkSubmodules()
AnyObjectId blobId = entry.getBlobId();
ObjectLoader blob = odb.open(blobId, Constants.OBJ_BLOB);
- SubmoduleValidator.assertValidGitModulesFile(
- new String(blob.getBytes(), UTF_8));
+ try {
+ SubmoduleValidator.assertValidGitModulesFile(
+ new String(blob.getBytes(), UTF_8));
+ } catch (LargeObjectException | SubmoduleValidationException e) {
+ throw new IOException(e);
+ }
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
index c43ab18..211707e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED;
import static org.eclipse.jgit.transport.ReceiveCommand.Result.OK;
import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_NONFASTFORWARD;
@@ -337,7 +338,7 @@ private void updateFETCH_HEAD(FetchResult result) throws IOException {
try {
if (lock.lock()) {
try (Writer w = new OutputStreamWriter(
- lock.getOutputStream())) {
+ lock.getOutputStream(), UTF_8)) {
for (FetchHeadRecord h : fetchHeadUpdates) {
h.write(w);
result.add(h);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchRequest.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchRequest.java
new file mode 100644
index 0000000..5d28a4d
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchRequest.java
@@ -0,0 +1,174 @@
+/*
+ * 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 static java.util.Objects.requireNonNull;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.lib.ObjectId;
+
+/**
+ * Common fields between v0/v1/v2 fetch requests.
+ */
+abstract class FetchRequest {
+
+ final Set<ObjectId> wantIds;
+
+ final int depth;
+
+ final Set<ObjectId> clientShallowCommits;
+
+ final long filterBlobLimit;
+
+ final Set<String> clientCapabilities;
+
+ final int deepenSince;
+
+ final List<String> deepenNotRefs;
+
+ /**
+ * Initialize the common fields of a fetch request.
+ *
+ * @param wantIds
+ * list of want ids
+ * @param depth
+ * how deep to go in the tree
+ * @param clientShallowCommits
+ * commits the client has without history
+ * @param filterBlobLimit
+ * to exclude blobs on certain conditions
+ * @param clientCapabilities
+ * capabilities sent in the request
+ * @param deepenNotRefs
+ * Requests that the shallow clone/fetch should be cut at these
+ * specific revisions instead of a depth.
+ * @param deepenSince
+ * Requests that the shallow clone/fetch should be cut at a
+ * specific time, instead of depth
+ */
+ FetchRequest(@NonNull Set<ObjectId> wantIds, int depth,
+ @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit,
+ @NonNull Set<String> clientCapabilities, int deepenSince,
+ @NonNull List<String> deepenNotRefs) {
+ this.wantIds = requireNonNull(wantIds);
+ this.depth = depth;
+ this.clientShallowCommits = requireNonNull(clientShallowCommits);
+ this.filterBlobLimit = filterBlobLimit;
+ this.clientCapabilities = requireNonNull(clientCapabilities);
+ this.deepenSince = deepenSince;
+ this.deepenNotRefs = requireNonNull(deepenNotRefs);
+ }
+
+ /**
+ * @return object ids in the "want" (and "want-ref") lines of the request
+ */
+ @NonNull
+ Set<ObjectId> getWantIds() {
+ return wantIds;
+ }
+
+ /**
+ * @return the depth set in a "deepen" line. 0 by default.
+ */
+ int getDepth() {
+ return depth;
+ }
+
+ /**
+ * Shallow commits the client already has.
+ *
+ * These are sent by the client in "shallow" request lines.
+ *
+ * @return set of commits the client has declared as shallow.
+ */
+ @NonNull
+ Set<ObjectId> getClientShallowCommits() {
+ return clientShallowCommits;
+ }
+
+ /**
+ * @return the blob limit set in a "filter" line (-1 if not set)
+ */
+ long getFilterBlobLimit() {
+ return filterBlobLimit;
+ }
+
+ /**
+ * Capabilities that the client wants enabled from the server.
+ *
+ * Capabilities are options that tune the expected response from the server,
+ * like "thin-pack", "no-progress" or "ofs-delta". This list should be a
+ * subset of the capabilities announced by the server in its first response.
+ *
+ * These options are listed and well-defined in the git protocol
+ * specification.
+ *
+ * @return capabilities sent by the client
+ */
+ @NonNull
+ Set<String> getClientCapabilities() {
+ return clientCapabilities;
+ }
+
+ /**
+ * The value in a "deepen-since" line in the request, indicating the
+ * timestamp where to stop fetching/cloning.
+ *
+ * @return timestamp in seconds since the epoch, where to stop the shallow
+ * fetch/clone. Defaults to 0 if not set in the request.
+ */
+ int getDeepenSince() {
+ return deepenSince;
+ }
+
+ /**
+ * @return refs received in "deepen-not" lines.
+ */
+ @NonNull
+ List<String> getDeepenNotRefs() {
+ return deepenNotRefs;
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV0Request.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV0Request.java
new file mode 100644
index 0000000..bb358c8
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV0Request.java
@@ -0,0 +1,133 @@
+/*
+ * 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.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.lib.ObjectId;
+
+/**
+ * Fetch request in the V0/V1 protocol.
+ */
+final class FetchV0Request extends FetchRequest {
+
+ FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth,
+ @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit,
+ @NonNull Set<String> clientCapabilities) {
+ super(wantIds, depth, clientShallowCommits, filterBlobLimit,
+ clientCapabilities, 0, Collections.emptyList());
+ }
+
+ static final class Builder {
+
+ int depth;
+
+ final Set<ObjectId> wantIds = new HashSet<>();
+
+ final Set<ObjectId> clientShallowCommits = new HashSet<>();
+
+ long filterBlobLimit = -1;
+
+ final Set<String> clientCaps = new HashSet<>();
+
+ /**
+ * @param objectId
+ * object id received in a "want" line
+ * @return this builder
+ */
+ Builder addWantId(ObjectId objectId) {
+ wantIds.add(objectId);
+ return this;
+ }
+
+ /**
+ * @param d
+ * depth set in a "deepen" line
+ * @return this builder
+ */
+ Builder setDepth(int d) {
+ depth = d;
+ return this;
+ }
+
+ /**
+ * @param shallowOid
+ * object id received in a "shallow" line
+ * @return this builder
+ */
+ Builder addClientShallowCommit(ObjectId shallowOid) {
+ clientShallowCommits.add(shallowOid);
+ return this;
+ }
+
+ /**
+ * @param clientCapabilities
+ * client capabilities sent by the client in the first want
+ * line of the request
+ * @return this builder
+ */
+ Builder addClientCapabilities(Collection<String> clientCapabilities) {
+ clientCaps.addAll(clientCapabilities);
+ return this;
+ }
+
+ /**
+ * @param filterBlobLim
+ * blob limit set in a "filter" line
+ * @return this builder
+ */
+ Builder setFilterBlobLimit(long filterBlobLim) {
+ filterBlobLimit = filterBlobLim;
+ return this;
+ }
+
+ FetchV0Request build() {
+ return new FetchV0Request(wantIds, depth, clientShallowCommits,
+ filterBlobLimit, clientCaps);
+ }
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java
index 853d969..951d2d7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchV2Request.java
@@ -42,7 +42,10 @@
*/
package org.eclipse.jgit.transport;
+import static java.util.Objects.requireNonNull;
+
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -50,121 +53,61 @@
import java.util.TreeMap;
import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.lib.ObjectId;
/**
- * fetch protocol v2 request.
+ * Fetch request from git protocol v2.
*
* <p>
* This is used as an input to {@link ProtocolV2Hook}.
*
* @since 5.1
*/
-public final class FetchV2Request {
+public final class FetchV2Request extends FetchRequest {
private final List<ObjectId> peerHas;
private final TreeMap<String, ObjectId> wantedRefs;
- private final Set<ObjectId> wantsIds;
-
- private final Set<ObjectId> clientShallowCommits;
-
- private final int deepenSince;
-
- private final List<String> deepenNotRefs;
-
- private final int depth;
-
- private final long filterBlobLimit;
-
- private final Set<String> options;
-
private final boolean doneReceived;
- private FetchV2Request(List<ObjectId> peerHas,
- TreeMap<String, ObjectId> wantedRefs, Set<ObjectId> wantsIds,
- Set<ObjectId> clientShallowCommits, int deepenSince,
- List<String> deepenNotRefs, int depth, long filterBlobLimit,
- boolean doneReceived, Set<String> options) {
- this.peerHas = peerHas;
- this.wantedRefs = wantedRefs;
- this.wantsIds = wantsIds;
- this.clientShallowCommits = clientShallowCommits;
- this.deepenSince = deepenSince;
- this.deepenNotRefs = deepenNotRefs;
- this.depth = depth;
- this.filterBlobLimit = filterBlobLimit;
+ @Nullable
+ private final String agent;
+
+ @NonNull
+ private final List<String> serverOptions;
+
+ FetchV2Request(@NonNull List<ObjectId> peerHas,
+ @NonNull TreeMap<String, ObjectId> wantedRefs,
+ @NonNull Set<ObjectId> wantIds,
+ @NonNull Set<ObjectId> clientShallowCommits, int deepenSince,
+ @NonNull List<String> deepenNotRefs, int depth,
+ long filterBlobLimit,
+ boolean doneReceived, @NonNull Set<String> clientCapabilities,
+ @Nullable String agent, @NonNull List<String> serverOptions) {
+ super(wantIds, depth, clientShallowCommits, filterBlobLimit,
+ clientCapabilities, deepenSince, deepenNotRefs);
+ this.peerHas = requireNonNull(peerHas);
+ this.wantedRefs = requireNonNull(wantedRefs);
this.doneReceived = doneReceived;
- this.options = options;
+ this.agent = agent;
+ this.serverOptions = requireNonNull(serverOptions);
}
/**
- * @return object ids in the "have" lines of the request
+ * @return object ids received in the "have" lines
*/
@NonNull
List<ObjectId> getPeerHas() {
- return this.peerHas;
+ return peerHas;
}
/**
- * @return list of references in the "want-ref" lines of the request
+ * @return list of references received in "want-ref" lines
*/
@NonNull
Map<String, ObjectId> getWantedRefs() {
- return this.wantedRefs;
- }
-
- /**
- * @return object ids in the "want" (and "want-ref") lines of the request
- */
- @NonNull
- Set<ObjectId> getWantsIds() {
- return wantsIds;
- }
-
- /**
- * Shallow commits the client already has.
- *
- * These are sent by the client in "shallow" request lines.
- *
- * @return set of commits the client has declared as shallow.
- */
- @NonNull
- Set<ObjectId> getClientShallowCommits() {
- return clientShallowCommits;
- }
-
- /**
- * The value in a "deepen-since" line in the request, indicating the
- * timestamp where to stop fetching/cloning.
- *
- * @return timestamp in seconds since the epoch, where to stop the shallow
- * fetch/clone. Defaults to 0 if not set in the request.
- */
- int getDeepenSince() {
- return deepenSince;
- }
-
- /**
- * @return the refs in "deepen-not" lines in the request.
- */
- @NonNull
- List<String> getDeepenNotRefs() {
- return deepenNotRefs;
- }
-
- /**
- * @return the depth set in a "deepen" line. 0 by default.
- */
- int getDepth() {
- return depth;
- }
-
- /**
- * @return the blob limit set in a "filter" line (-1 if not set)
- */
- long getFilterBlobLimit() {
- return filterBlobLimit;
+ return wantedRefs;
}
/**
@@ -175,17 +118,25 @@ boolean wasDoneReceived() {
}
/**
- * Options that tune the expected response from the server, like
- * "thin-pack", "no-progress" or "ofs-delta"
+ * @return string identifying the agent (as sent in the request body by the
+ * client)
+ */
+ @Nullable
+ String getAgent() {
+ return agent;
+ }
+
+ /**
+ * Options received in server-option lines. The caller can choose to act on
+ * these in an application-specific way
*
- * These are options listed and well-defined in the git protocol
- * specification
+ * @return Immutable list of server options received in the request
*
- * @return options found in the request lines
+ * @since 5.2
*/
@NonNull
- Set<String> getOptions() {
- return options;
+ public List<String> getServerOptions() {
+ return serverOptions;
}
/** @return A builder of {@link FetchV2Request}. */
@@ -193,20 +144,19 @@ static Builder builder() {
return new Builder();
}
-
/** A builder for {@link FetchV2Request}. */
static final class Builder {
- List<ObjectId> peerHas = new ArrayList<>();
+ final List<ObjectId> peerHas = new ArrayList<>();
- TreeMap<String, ObjectId> wantedRefs = new TreeMap<>();
+ final TreeMap<String, ObjectId> wantedRefs = new TreeMap<>();
- Set<ObjectId> wantsIds = new HashSet<>();
+ final Set<ObjectId> wantIds = new HashSet<>();
- Set<ObjectId> clientShallowCommits = new HashSet<>();
+ final Set<ObjectId> clientShallowCommits = new HashSet<>();
- List<String> deepenNotRefs = new ArrayList<>();
+ final List<String> deepenNotRefs = new ArrayList<>();
- Set<String> options = new HashSet<>();
+ final Set<String> clientCapabilities = new HashSet<>();
int depth;
@@ -216,13 +166,18 @@ static final class Builder {
boolean doneReceived;
+ @Nullable
+ String agent;
+
+ final List<String> serverOptions = new ArrayList<>();
+
private Builder() {
}
/**
* @param objectId
- * from a "have" line in a fetch request
- * @return the builder
+ * object id received in a "have" line
+ * @return this builder
*/
Builder addPeerHas(ObjectId objectId) {
peerHas.add(objectId);
@@ -230,13 +185,13 @@ Builder addPeerHas(ObjectId objectId) {
}
/**
- * From a "want-ref" line in a fetch request
+ * Ref received in "want-ref" line and the object-id it refers to
*
* @param refName
* reference name
* @param oid
- * object id
- * @return the builder
+ * object id the reference is pointing at
+ * @return this builder
*/
Builder addWantedRef(String refName, ObjectId oid) {
wantedRefs.put(refName, oid);
@@ -244,42 +199,42 @@ Builder addWantedRef(String refName, ObjectId oid) {
}
/**
- * @param option
- * fetch request lines acting as options
- * @return the builder
+ * @param clientCapability
+ * capability line sent by the client
+ * @return this builder
*/
- Builder addOption(String option) {
- options.add(option);
+ Builder addClientCapability(String clientCapability) {
+ clientCapabilities.add(clientCapability);
return this;
}
/**
- * @param objectId
- * from a "want" line in a fetch request
- * @return the builder
+ * @param wantId
+ * object id received in a "want" line
+ * @return this builder
*/
- Builder addWantsIds(ObjectId objectId) {
- wantsIds.add(objectId);
+ Builder addWantId(ObjectId wantId) {
+ wantIds.add(wantId);
return this;
}
/**
* @param shallowOid
- * from a "shallow" line in the fetch request
- * @return the builder
+ * object id received in a "shallow" line
+ * @return this builder
*/
Builder addClientShallowCommit(ObjectId shallowOid) {
- this.clientShallowCommits.add(shallowOid);
+ clientShallowCommits.add(shallowOid);
return this;
}
/**
* @param d
- * from a "deepen" line in the fetch request
- * @return the builder
+ * Depth received in a "deepen" line
+ * @return this builder
*/
Builder setDepth(int d) {
- this.depth = d;
+ depth = d;
return this;
}
@@ -288,32 +243,34 @@ Builder setDepth(int d) {
* 0 if not set.
*/
int getDepth() {
- return this.depth;
+ return depth;
}
/**
- * @return if there has been any "deepen not" line in the request
+ * @return true if there has been at least one "deepen not" line in the
+ * request so far
*/
boolean hasDeepenNotRefs() {
return !deepenNotRefs.isEmpty();
}
/**
- * @param deepenNotRef reference in a "deepen not" line
- * @return the builder
+ * @param deepenNotRef
+ * reference received in a "deepen not" line
+ * @return this builder
*/
Builder addDeepenNotRef(String deepenNotRef) {
- this.deepenNotRefs.add(deepenNotRef);
+ deepenNotRefs.add(deepenNotRef);
return this;
}
/**
* @param value
* Unix timestamp received in a "deepen since" line
- * @return the builder
+ * @return this builder
*/
Builder setDeepenSince(int value) {
- this.deepenSince = value;
+ deepenSince = value;
return this;
}
@@ -322,35 +279,66 @@ Builder setDeepenSince(int value) {
* by default.
*/
int getDeepenSince() {
- return this.deepenSince;
+ return deepenSince;
}
/**
- * @param filterBlobLimit
+ * @param filterBlobLim
* set in a "filter" line
- * @return the builder
+ * @return this builder
*/
- Builder setFilterBlobLimit(long filterBlobLimit) {
- this.filterBlobLimit = filterBlobLimit;
+ Builder setFilterBlobLimit(long filterBlobLim) {
+ filterBlobLimit = filterBlobLim;
return this;
}
/**
* Mark that the "done" line has been received.
*
- * @return the builder
+ * @return this builder
*/
Builder setDoneReceived() {
- this.doneReceived = true;
+ doneReceived = true;
return this;
}
+
+ /**
+ * Value of an agent line received after the command and before the
+ * arguments. E.g. "agent=a.b.c/1.0" should set "a.b.c/1.0".
+ *
+ * @param agentValue
+ * the client-supplied agent capability, without the leading
+ * "agent="
+ * @return this builder
+ */
+ Builder setAgent(@Nullable String agentValue) {
+ agent = agentValue;
+ return this;
+ }
+
+ /**
+ * Records an application-specific option supplied in a server-option
+ * line, for later retrieval with
+ * {@link FetchV2Request#getServerOptions}.
+ *
+ * @param value
+ * the client-supplied server-option capability, without
+ * leading "server-option=".
+ * @return this builder
+ */
+ Builder addServerOption(@NonNull String value) {
+ serverOptions.add(value);
+ return this;
+ }
+
/**
* @return Initialized fetch request
*/
FetchV2Request build() {
- return new FetchV2Request(peerHas, wantedRefs, wantsIds,
+ return new FetchV2Request(peerHas, wantedRefs, wantIds,
clientShallowCommits, deepenSince, deepenNotRefs,
- depth, filterBlobLimit, doneReceived, options);
+ depth, filterBlobLimit, doneReceived, clientCapabilities,
+ agent, Collections.unmodifiableList(serverOptions));
}
}
}
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 760ac6c..1561c93 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/GitProtocolConstants.java
@@ -245,6 +245,20 @@ public final class GitProtocolConstants {
public static final String CAPABILITY_REF_IN_WANT = "ref-in-want"; //$NON-NLS-1$
/**
+ * The server supports arbitrary options
+ *
+ * @since 5.2
+ */
+ public static final String CAPABILITY_SERVER_OPTION = "server-option"; //$NON-NLS-1$
+
+ /**
+ * Option for passing application-specific options to the server.
+ *
+ * @since 5.2
+ */
+ public static final String OPTION_SERVER_OPTION = "server-option"; //$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/LsRefsV2Request.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java
index 3aff584..add3731 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/LsRefsV2Request.java
@@ -42,9 +42,15 @@
*/
package org.eclipse.jgit.transport;
+import static java.util.Objects.requireNonNull;
+
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.jgit.annotations.NonNull;
+import org.eclipse.jgit.annotations.Nullable;
+
/**
* ls-refs protocol v2 request.
*
@@ -60,11 +66,20 @@ public final class LsRefsV2Request {
private final boolean peel;
+ @Nullable
+ private final String agent;
+
+ @NonNull
+ private final List<String> serverOptions;
+
private LsRefsV2Request(List<String> refPrefixes, boolean symrefs,
- boolean peel) {
+ boolean peel, @Nullable String agent,
+ @NonNull List<String> serverOptions) {
this.refPrefixes = refPrefixes;
this.symrefs = symrefs;
this.peel = peel;
+ this.agent = agent;
+ this.serverOptions = requireNonNull(serverOptions);
}
/** @return ref prefixes that the client requested. */
@@ -82,6 +97,34 @@ public boolean getPeel() {
return peel;
}
+ /**
+ * @return agent as reported by the client
+ *
+ * @since 5.2
+ */
+ @Nullable
+ public String getAgent() {
+ return agent;
+ }
+
+ /**
+ * Get application-specific options provided by the client using
+ * --server-option.
+ * <p>
+ * It returns just the content, without the "server-option=" prefix. E.g. a
+ * request with server-option=A and server-option=B lines returns the list
+ * [A, B].
+ *
+ * @return application-specific options from the client as an unmodifiable
+ * list
+ *
+ * @since 5.2
+ */
+ @NonNull
+ public List<String> getServerOptions() {
+ return serverOptions;
+ }
+
/** @return A builder of {@link LsRefsV2Request}. */
public static Builder builder() {
return new Builder();
@@ -95,6 +138,10 @@ public static final class Builder {
private boolean peel;
+ private final List<String> serverOptions = new ArrayList<>();
+
+ private String agent;
+
private Builder() {
}
@@ -125,10 +172,43 @@ public Builder setPeel(boolean value) {
return this;
}
+ /**
+ * Records an application-specific option supplied in a server-option
+ * line, for later retrieval with
+ * {@link LsRefsV2Request#getServerOptions}.
+ *
+ * @param value
+ * the client-supplied server-option capability, without
+ * leading "server-option=".
+ * @return this builder
+ * @since 5.2
+ */
+ public Builder addServerOption(@NonNull String value) {
+ serverOptions.add(value);
+ return this;
+ }
+
+ /**
+ * Value of an agent line received after the command and before the
+ * arguments. E.g. "agent=a.b.c/1.0" should set "a.b.c/1.0".
+ *
+ * @param value
+ * the client-supplied agent capability, without leading
+ * "agent="
+ * @return this builder
+ *
+ * @since 5.2
+ */
+ public Builder setAgent(@Nullable String value) {
+ agent = value;
+ return this;
+ }
+
/** @return LsRefsV2Request */
public LsRefsV2Request build() {
return new LsRefsV2Request(
- Collections.unmodifiableList(refPrefixes), symrefs, peel);
+ Collections.unmodifiableList(refPrefixes), symrefs, peel,
+ agent, Collections.unmodifiableList(serverOptions));
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java
index e688f63..8562376 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java
@@ -42,10 +42,13 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.Collection;
import java.util.HashMap;
import java.util.Locale;
@@ -211,7 +214,8 @@ private void parse() {
this.hosts.clear();
this.lastModified = this.netrc.lastModified();
- try (BufferedReader r = new BufferedReader(new FileReader(netrc))) {
+ try (BufferedReader r = new BufferedReader(
+ new InputStreamReader(new FileInputStream(netrc), UTF_8))) {
String line = null;
NetRCEntry entry = new NetRCEntry();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
index 480055c..a5fa3fe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java
@@ -43,6 +43,8 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -241,7 +243,8 @@ private synchronized State refresh() {
private Map<String, HostEntry> parse(InputStream in)
throws IOException {
final Map<String, HostEntry> m = new LinkedHashMap<>();
- final BufferedReader br = new BufferedReader(new InputStreamReader(in));
+ final BufferedReader br = new BufferedReader(
+ new InputStreamReader(in, UTF_8));
final List<HostEntry> current = new ArrayList<>(4);
String line;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV0Parser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV0Parser.java
new file mode 100644
index 0000000..60d5fff
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV0Parser.java
@@ -0,0 +1,157 @@
+/*
+ * 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 static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_FILTER;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.errors.PackProtocolException;
+import org.eclipse.jgit.internal.JGitText;
+import org.eclipse.jgit.internal.transport.parser.FirstWant;
+import org.eclipse.jgit.lib.ObjectId;
+
+/**
+ * Parser for git protocol versions 0 and 1.
+ *
+ * It reads the lines coming through the {@link PacketLineIn} and builds a
+ * {@link FetchV0Request} object.
+ *
+ * It requires a transferConfig object to know if the server supports filters.
+ */
+final class ProtocolV0Parser {
+
+ private final TransferConfig transferConfig;
+
+ ProtocolV0Parser(TransferConfig transferConfig) {
+ this.transferConfig = transferConfig;
+ }
+
+ /**
+ * Parse an incoming protocol v1 upload request arguments from the wire.
+ *
+ * The incoming PacketLineIn is consumed until an END line, but the caller
+ * is responsible for closing it (if needed).
+ *
+ * @param pckIn
+ * incoming lines. This method will read until an END line.
+ * @return a FetchV0Request with the data received in the wire.
+ * @throws PackProtocolException
+ * @throws IOException
+ */
+ FetchV0Request recvWants(PacketLineIn pckIn)
+ throws PackProtocolException, IOException {
+ FetchV0Request.Builder reqBuilder = new FetchV0Request.Builder();
+
+ boolean isFirst = true;
+ boolean filterReceived = false;
+
+ for (;;) {
+ String line;
+ try {
+ line = pckIn.readString();
+ } catch (EOFException eof) {
+ if (isFirst) {
+ break;
+ }
+ throw eof;
+ }
+
+ if (line == PacketLineIn.END) {
+ break;
+ }
+
+ if (line.startsWith("deepen ")) { //$NON-NLS-1$
+ int depth = Integer.parseInt(line.substring(7));
+ if (depth <= 0) {
+ throw new PackProtocolException(
+ MessageFormat.format(JGitText.get().invalidDepth,
+ Integer.valueOf(depth)));
+ }
+ reqBuilder.setDepth(depth);
+ continue;
+ }
+
+ if (line.startsWith("shallow ")) { //$NON-NLS-1$
+ reqBuilder.addClientShallowCommit(
+ ObjectId.fromString(line.substring(8)));
+ continue;
+ }
+
+ if (transferConfig.isAllowFilter()
+ && line.startsWith(OPTION_FILTER + " ")) { //$NON-NLS-1$
+ String arg = line.substring(OPTION_FILTER.length() + 1);
+
+ if (filterReceived) {
+ throw new PackProtocolException(
+ JGitText.get().tooManyFilters);
+ }
+ filterReceived = true;
+
+ reqBuilder.setFilterBlobLimit(ProtocolV2Parser.filterLine(arg));
+ continue;
+ }
+
+ if (!line.startsWith("want ") || line.length() < 45) { //$NON-NLS-1$
+ throw new PackProtocolException(MessageFormat
+ .format(JGitText.get().expectedGot, "want", line)); //$NON-NLS-1$
+ }
+
+ if (isFirst) {
+ if (line.length() > 45) {
+ FirstWant firstLine = FirstWant.fromLine(line);
+ reqBuilder.addClientCapabilities(firstLine.getCapabilities());
+ line = firstLine.getLine();
+ }
+ }
+
+ reqBuilder.addWantId(ObjectId.fromString(line.substring(5)));
+ isFirst = false;
+ }
+
+ return reqBuilder.build();
+ }
+
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java
index eae2c6e..a03f021 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java
@@ -44,15 +44,20 @@
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_DEEPEN_RELATIVE;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_FILTER;
+import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_AGENT;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_INCLUDE_TAG;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_NO_PROGRESS;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_OFS_DELTA;
+import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_SERVER_OPTION;
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.IOException;
import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.internal.JGitText;
@@ -75,6 +80,35 @@ final class ProtocolV2Parser {
this.transferConfig = transferConfig;
}
+ /*
+ * Read lines until DELIM or END, calling the appropiate consumer.
+ *
+ * Returns the last read line (so caller can check if there is more to read
+ * in the line).
+ */
+ private static String consumeCapabilities(PacketLineIn pckIn,
+ Consumer<String> serverOptionConsumer,
+ Consumer<String> agentConsumer) throws IOException {
+
+ String serverOptionPrefix = OPTION_SERVER_OPTION + '=';
+ String agentPrefix = OPTION_AGENT + '=';
+
+ String line = pckIn.readString();
+ while (line != PacketLineIn.DELIM && line != PacketLineIn.END) {
+ if (line.startsWith(serverOptionPrefix)) {
+ serverOptionConsumer
+ .accept(line.substring(serverOptionPrefix.length()));
+ } else if (line.startsWith(agentPrefix)) {
+ agentConsumer.accept(line.substring(agentPrefix.length()));
+ } else {
+ // Unrecognized capability. Ignore it.
+ }
+ line = pckIn.readString();
+ }
+
+ return line;
+ }
+
/**
* Parse the incoming fetch request arguments from the wire. The caller must
* be sure that what is comings is a fetch request before coming here.
@@ -102,21 +136,26 @@ FetchV2Request parseFetchRequest(PacketLineIn pckIn, RefDatabase refdb)
// Packs are always sent multiplexed and using full 64K
// lengths.
- reqBuilder.addOption(OPTION_SIDE_BAND_64K);
+ reqBuilder.addClientCapability(OPTION_SIDE_BAND_64K);
- String line;
+ String line = consumeCapabilities(pckIn,
+ serverOption -> reqBuilder.addServerOption(serverOption),
+ agent -> reqBuilder.setAgent(agent));
- // Currently, we do not support any capabilities, so the next
- // line is DELIM.
- if ((line = pckIn.readString()) != PacketLineIn.DELIM) {
- throw new PackProtocolException(MessageFormat
- .format(JGitText.get().unexpectedPacketLine, line));
+ if (line == PacketLineIn.END) {
+ return reqBuilder.build();
+ }
+
+ if (line != PacketLineIn.DELIM) {
+ throw new PackProtocolException(
+ MessageFormat.format(JGitText.get().unexpectedPacketLine,
+ line));
}
boolean filterReceived = false;
while ((line = pckIn.readString()) != PacketLineIn.END) {
if (line.startsWith("want ")) { //$NON-NLS-1$
- reqBuilder.addWantsIds(ObjectId.fromString(line.substring(5)));
+ reqBuilder.addWantId(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);
@@ -134,19 +173,19 @@ FetchV2Request parseFetchRequest(PacketLineIn pckIn, RefDatabase refdb)
.format(JGitText.get().invalidRefName, refName));
}
reqBuilder.addWantedRef(refName, oid);
- reqBuilder.addWantsIds(oid);
+ reqBuilder.addWantId(oid);
} else if (line.startsWith("have ")) { //$NON-NLS-1$
reqBuilder.addPeerHas(ObjectId.fromString(line.substring(5)));
} else if (line.equals("done")) { //$NON-NLS-1$
reqBuilder.setDoneReceived();
} else if (line.equals(OPTION_THIN_PACK)) {
- reqBuilder.addOption(OPTION_THIN_PACK);
+ reqBuilder.addClientCapability(OPTION_THIN_PACK);
} else if (line.equals(OPTION_NO_PROGRESS)) {
- reqBuilder.addOption(OPTION_NO_PROGRESS);
+ reqBuilder.addClientCapability(OPTION_NO_PROGRESS);
} else if (line.equals(OPTION_INCLUDE_TAG)) {
- reqBuilder.addOption(OPTION_INCLUDE_TAG);
+ reqBuilder.addClientCapability(OPTION_INCLUDE_TAG);
} else if (line.equals(OPTION_OFS_DELTA)) {
- reqBuilder.addOption(OPTION_OFS_DELTA);
+ reqBuilder.addClientCapability(OPTION_OFS_DELTA);
} else if (line.startsWith("shallow ")) { //$NON-NLS-1$
reqBuilder.addClientShallowCommit(
ObjectId.fromString(line.substring(8)));
@@ -173,7 +212,7 @@ FetchV2Request parseFetchRequest(PacketLineIn pckIn, RefDatabase refdb)
JGitText.get().deepenNotWithDeepen);
}
} else if (line.equals(OPTION_DEEPEN_RELATIVE)) {
- reqBuilder.addOption(OPTION_DEEPEN_RELATIVE);
+ reqBuilder.addClientCapability(OPTION_DEEPEN_RELATIVE);
} else if (line.startsWith("deepen-since ")) { //$NON-NLS-1$
int ts = Integer.parseInt(line.substring(13));
if (ts <= 0) {
@@ -204,6 +243,57 @@ FetchV2Request parseFetchRequest(PacketLineIn pckIn, RefDatabase refdb)
}
/**
+ * Parse the incoming ls-refs request arguments from the wire. This is meant
+ * for calling immediately after the caller has consumed a "command=ls-refs"
+ * line indicating the beginning of a ls-refs request.
+ *
+ * The incoming PacketLineIn is consumed until an END line, but the caller
+ * is responsible for closing it (if needed)
+ *
+ * @param pckIn
+ * incoming lines. This method will read until an END line.
+ * @return a LsRefsV2Request object with the data received in the wire.
+ * @throws PackProtocolException
+ * for inconsistencies in the protocol (e.g. unexpected lines)
+ * @throws IOException
+ * reporting problems reading the incoming messages from the
+ * wire
+ */
+ LsRefsV2Request parseLsRefsRequest(PacketLineIn pckIn)
+ throws PackProtocolException, IOException {
+ LsRefsV2Request.Builder builder = LsRefsV2Request.builder();
+ List<String> prefixes = new ArrayList<>();
+
+ String line = consumeCapabilities(pckIn,
+ serverOption -> builder.addServerOption(serverOption),
+ agent -> builder.setAgent(agent));
+
+ if (line == PacketLineIn.END) {
+ return builder.build();
+ }
+
+ if (line != PacketLineIn.DELIM) {
+ throw new PackProtocolException(MessageFormat
+ .format(JGitText.get().unexpectedPacketLine, line));
+ }
+
+ while ((line = pckIn.readString()) != PacketLineIn.END) {
+ if (line.equals("peel")) { //$NON-NLS-1$
+ builder.setPeel(true);
+ } else if (line.equals("symrefs")) { //$NON-NLS-1$
+ builder.setSymrefs(true);
+ } else if (line.startsWith("ref-prefix ")) { //$NON-NLS-1$
+ prefixes.add(line.substring("ref-prefix ".length())); //$NON-NLS-1$
+ } else {
+ throw new PackProtocolException(MessageFormat
+ .format(JGitText.get().unexpectedPacketLine, line));
+ }
+ }
+
+ return builder.setRefPrefixes(prefixes).build();
+ }
+
+ /*
* Process the content of "filter" line from the protocol. It has a shape
* like "blob:none" or "blob:limit=N", with limit a positive number.
*
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
index 4662435..6595cab 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
@@ -207,7 +207,8 @@ public void setUseProtocolV2(boolean b) {
* <p>
* This method must be invoked prior to any of the following:
* <ul>
- * <li>{@link #send(Map)}
+ * <li>{@link #send(Map)}</li>
+ * <li>{@link #send(Collection)}</li>
* </ul>
*
* @param deref
@@ -223,8 +224,9 @@ public void setDerefTags(boolean deref) {
* <p>
* This method must be invoked prior to any of the following:
* <ul>
- * <li>{@link #send(Map)}
- * <li>{@link #advertiseHave(AnyObjectId)}
+ * <li>{@link #send(Map)}</li>
+ * <li>{@link #send(Collection)}</li>
+ * <li>{@link #advertiseHave(AnyObjectId)}</li>
* </ul>
*
* @param name
@@ -257,8 +259,9 @@ public void advertiseCapability(String name, String value) {
* <p>
* This method must be invoked prior to any of the following:
* <ul>
- * <li>{@link #send(Map)}
- * <li>{@link #advertiseHave(AnyObjectId)}
+ * <li>{@link #send(Map)}</li>
+ * <li>{@link #send(Collection)}</li>
+ * <li>{@link #advertiseHave(AnyObjectId)}</li>
* </ul>
*
* @param from
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
index 90600cb..fde4401 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
@@ -236,7 +236,7 @@ private void doProgressLine(String msg) throws IOException {
messages.write(msg);
if (out != null)
- out.write(msg.getBytes());
+ out.write(msg.getBytes(UTF_8));
}
private void beginTask(int totalWorkUnits) {
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 6b8d5c5..4f2ea64 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
@@ -106,7 +106,8 @@ enum ProtocolVersion {
this.name = name;
}
- static @Nullable ProtocolVersion parse(@Nullable String name) {
+ @Nullable
+ static ProtocolVersion parse(@Nullable String name) {
if (name == null) {
return null;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
index 026fd81..70fb1f0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
@@ -48,10 +48,11 @@
package org.eclipse.jgit.transport;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.BitSet;
@@ -282,12 +283,7 @@ private static String unescape(String s) throws URISyntaxException {
if (s.indexOf('%') < 0)
return s;
- byte[] bytes;
- try {
- bytes = s.getBytes(Constants.CHARACTER_ENCODING);
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e); // can't happen
- }
+ byte[] bytes = s.getBytes(UTF_8);
byte[] os = new byte[bytes.length];
int j = 0;
@@ -335,12 +331,7 @@ private static String escape(String s, boolean escapeReservedChars,
if (s == null)
return null;
ByteArrayOutputStream os = new ByteArrayOutputStream(s.length());
- byte[] bytes;
- try {
- bytes = s.getBytes(Constants.CHARACTER_ENCODING);
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e); // cannot happen
- }
+ byte[] bytes = s.getBytes(UTF_8);
for (int i = 0; i < bytes.length; ++i) {
int b = bytes[i] & 0xFF;
if (b <= 32 || (encodeNonAscii && b > 127) || b == '%'
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 cd7290e..535c914 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -48,6 +48,7 @@
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.CAPABILITY_SERVER_OPTION;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_AGENT;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_ALLOW_REACHABLE_SHA1_IN_WANT;
import static org.eclipse.jgit.transport.GitProtocolConstants.OPTION_ALLOW_TIP_SHA1_IN_WANT;
@@ -69,6 +70,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.UncheckedIOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -86,6 +88,7 @@
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.pack.PackWriter;
+import org.eclipse.jgit.internal.transport.parser.FirstWant;
import org.eclipse.jgit.lib.BitmapIndex;
import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder;
import org.eclipse.jgit.lib.Constants;
@@ -177,44 +180,48 @@ void checkWants(UploadPack up, List<ObjectId> wants)
throws PackProtocolException, IOException;
}
- /** Data in the first line of a request, the line itself plus options. */
+ /**
+ * Data in the first line of a want-list, the line itself plus options.
+ *
+ * @deprecated Use {@link FirstWant} instead
+ */
+ @Deprecated
public static class FirstLine {
- private final String line;
- private final Set<String> options;
+
+ private final FirstWant firstWant;
/**
- * Parse the first line of a receive-pack request.
- *
* @param line
* line from the client.
*/
public FirstLine(String line) {
- if (line.length() > 45) {
- final HashSet<String> opts = new HashSet<>();
- String opt = line.substring(45);
- if (opt.startsWith(" ")) //$NON-NLS-1$
- opt = opt.substring(1);
- for (String c : opt.split(" ")) //$NON-NLS-1$
- opts.add(c);
- this.line = line.substring(0, 45);
- this.options = Collections.unmodifiableSet(opts);
- } else {
- this.line = line;
- this.options = Collections.emptySet();
+ try {
+ firstWant = FirstWant.fromLine(line);
+ } catch (PackProtocolException e) {
+ throw new UncheckedIOException(e);
}
}
/** @return non-capabilities part of the line. */
public String getLine() {
- return line;
+ return firstWant.getLine();
}
- /** @return options parsed from the line. */
+ /** @return capabilities parsed from the line. */
public Set<String> getOptions() {
- return options;
+ return firstWant.getCapabilities();
}
}
+ /*
+ * {@link java.util.function.Consumer} doesn't allow throwing checked
+ * exceptions. Define our own to propagate IOExceptions.
+ */
+ @FunctionalInterface
+ private static interface IOConsumer<R> {
+ void accept(R t) throws IOException;
+ }
+
/** Database we read the objects from. */
private final Repository db;
@@ -280,12 +287,11 @@ public Set<String> getOptions() {
/** Hook for taking post upload actions. */
private PostUploadHook postUploadHook = PostUploadHook.NULL;
- /** Capabilities requested by the client. */
- private Set<String> options;
+ /** Caller user agent */
String userAgent;
/** Raw ObjectIds the client has asked for, before validating them. */
- private final Set<ObjectId> wantIds = new HashSet<>();
+ private Set<ObjectId> wantIds = new HashSet<>();
/** Objects the client wants to obtain. */
private final Set<RevObject> wantAll = new HashSet<>();
@@ -293,25 +299,6 @@ public Set<String> getOptions() {
/** Objects on both sides, these don't have to be sent. */
private final Set<RevObject> commonBase = new HashSet<>();
- /** Shallow commits the client already has. */
- private Set<ObjectId> clientShallowCommits = new HashSet<>();
-
- /** Desired depth from the client on a shallow request. */
- private int depth;
-
- /**
- * Commit time of the newest objects the client has asked us using
- * --shallow-since not to send. Cannot be nonzero if depth is nonzero.
- */
- private int shallowSince;
-
- /**
- * (Possibly short) ref names, ancestors of which the client has asked us
- * not to send using --shallow-exclude. Cannot be non-empty if depth is
- * nonzero.
- */
- private List<String> deepenNotRefs = new ArrayList<>();
-
/** Commit time of the oldest common commit, in seconds. */
private int oldestTime;
@@ -345,7 +332,14 @@ public Set<String> getOptions() {
private PackStatistics statistics;
- private long filterBlobLimit = -1;
+ /**
+ * Request this instance is handling.
+ *
+ * We need to keep a reference to it for {@link PreUploadHook pre upload
+ * hooks}. They receive a reference this instance and invoke methods like
+ * getDepth() to get information about the request.
+ */
+ private FetchRequest currentRequest;
/**
* Create a new pack upload for an open repository.
@@ -687,10 +681,12 @@ public void setTransferConfig(TransferConfig tc) {
* read.
*/
public boolean isSideBand() throws RequestNotYetReadException {
- if (options == null)
+ if (currentRequest == null) {
throw new RequestNotYetReadException();
- return (options.contains(OPTION_SIDE_BAND)
- || options.contains(OPTION_SIDE_BAND_64K));
+ }
+ Set<String> caps = currentRequest.getClientCapabilities();
+ return caps.contains(OPTION_SIDE_BAND)
+ || caps.contains(OPTION_SIDE_BAND_64K);
}
/**
@@ -804,6 +800,7 @@ private void service() throws IOException {
// writing a response. Buffer the response until then.
PackStatistics.Accumulator accumulator = new PackStatistics.Accumulator();
List<ObjectId> unshallowCommits = new ArrayList<>();
+ FetchRequest req;
try {
if (biDirectionalPipe)
sendAdvertisedRefs(new PacketLineOutRefAdvertiser(pckOut));
@@ -814,29 +811,46 @@ else if (requestValidator instanceof AnyRequestValidator)
long negotiateStart = System.currentTimeMillis();
accumulator.advertised = advertised.size();
- recvWants();
- if (wantIds.isEmpty()) {
- preUploadHook.onBeginNegotiateRound(this, wantIds, 0);
- preUploadHook.onEndNegotiateRound(this, wantIds, 0, 0, false);
+
+ ProtocolV0Parser parser = new ProtocolV0Parser(transferConfig);
+ req = parser.recvWants(pckIn);
+ currentRequest = req;
+
+ wantIds = req.getWantIds();
+
+ if (req.getWantIds().isEmpty()) {
+ preUploadHook.onBeginNegotiateRound(this, req.getWantIds(), 0);
+ preUploadHook.onEndNegotiateRound(this, req.getWantIds(), 0, 0,
+ false);
return;
}
- accumulator.wants = wantIds.size();
+ accumulator.wants = req.getWantIds().size();
- if (options.contains(OPTION_MULTI_ACK_DETAILED)) {
+ if (req.getClientCapabilities().contains(OPTION_MULTI_ACK_DETAILED)) {
multiAck = MultiAck.DETAILED;
- noDone = options.contains(OPTION_NO_DONE);
- } else if (options.contains(OPTION_MULTI_ACK))
+ noDone = req.getClientCapabilities().contains(OPTION_NO_DONE);
+ } else if (req.getClientCapabilities().contains(OPTION_MULTI_ACK))
multiAck = MultiAck.CONTINUE;
else
multiAck = MultiAck.OFF;
- if (!clientShallowCommits.isEmpty())
- verifyClientShallow(clientShallowCommits);
- if (depth != 0)
- processShallow(null, unshallowCommits, true);
- if (!clientShallowCommits.isEmpty())
- walk.assumeShallow(clientShallowCommits);
- sendPack = negotiate(accumulator);
+ if (!req.getClientShallowCommits().isEmpty()) {
+ verifyClientShallow(req.getClientShallowCommits());
+ }
+
+ if (req.getDepth() != 0 || req.getDeepenSince() != 0) {
+ computeShallowsAndUnshallows(req, shallow -> {
+ pckOut.writeString("shallow " + shallow.name() + '\n'); //$NON-NLS-1$
+ }, unshallow -> {
+ pckOut.writeString("unshallow " + unshallow.name() + '\n'); //$NON-NLS-1$
+ unshallowCommits.add(unshallow);
+ });
+ pckOut.end();
+ }
+
+ if (!req.getClientShallowCommits().isEmpty())
+ walk.assumeShallow(req.getClientShallowCommits());
+ sendPack = negotiate(req, accumulator);
accumulator.timeNegotiating += System.currentTimeMillis()
- negotiateStart;
@@ -886,35 +900,14 @@ else if (requestValidator instanceof AnyRequestValidator)
}
if (sendPack) {
- sendPack(accumulator, refs == null ? null : refs.values(), unshallowCommits);
+ sendPack(accumulator, req, refs == null ? null : refs.values(),
+ unshallowCommits);
}
}
private void lsRefsV2() throws IOException {
- 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$
- builder.setPeel(true);
- } else if (line.equals("symrefs")) { //$NON-NLS-1$
- builder.setSymrefs(true);
- } else if (line.startsWith("ref-prefix ")) { //$NON-NLS-1$
- prefixes.add(line.substring("ref-prefix ".length())); //$NON-NLS-1$
- } else {
- throw new PackProtocolException(MessageFormat
- .format(JGitText.get().unexpectedPacketLine, line));
- }
- }
- } else if (line != PacketLineIn.END) {
- throw new PackProtocolException(MessageFormat
- .format(JGitText.get().unexpectedPacketLine, line));
- }
- LsRefsV2Request req = builder.setRefPrefixes(prefixes).build();
-
+ ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig);
+ LsRefsV2Request req = parser.parseLsRefsRequest(pckIn);
protocolV2Hook.onLsRefs(req);
rawOut.stopBuffering();
@@ -928,10 +921,9 @@ private void lsRefsV2() throws IOException {
refsToSend = getAdvertisedOrDefaultRefs();
} else {
refsToSend = new HashMap<>();
- for (String refPrefix : req.getRefPrefixes()) {
- for (Ref ref : db.getRefDatabase().getRefsByPrefix(refPrefix)) {
- refsToSend.put(ref.getName(), ref);
- }
+ String[] prefixes = req.getRefPrefixes().toArray(new String[0]);
+ for (Ref ref : db.getRefDatabase().getRefsByPrefix(prefixes)) {
+ refsToSend.put(ref.getName(), ref);
}
}
if (req.getSymrefs()) {
@@ -958,31 +950,29 @@ private void fetchV2() throws IOException {
ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig);
FetchV2Request req = parser.parseFetchRequest(pckIn,
db.getRefDatabase());
+ currentRequest = req;
rawOut.stopBuffering();
protocolV2Hook.onFetch(req);
// TODO(ifrade): Refactor to pass around the Request object, instead of
// copying data back to class fields
- options = req.getOptions();
- wantIds.addAll(req.getWantsIds());
- clientShallowCommits = req.getClientShallowCommits();
- depth = req.getDepth();
- shallowSince = req.getDeepenSince();
- filterBlobLimit = req.getFilterBlobLimit();
- deepenNotRefs = req.getDeepenNotRefs();
+ wantIds = req.getWantIds();
boolean sectionSent = false;
- @Nullable List<ObjectId> shallowCommits = null;
+ boolean mayHaveShallow = req.getDepth() != 0
+ || req.getDeepenSince() != 0
+ || !req.getDeepenNotRefs().isEmpty();
+ List<ObjectId> shallowCommits = new ArrayList<>();
List<ObjectId> unshallowCommits = new ArrayList<>();
if (!req.getClientShallowCommits().isEmpty()) {
verifyClientShallow(req.getClientShallowCommits());
}
- if (req.getDepth() != 0 || req.getDeepenSince() != 0
- || !req.getDeepenNotRefs().isEmpty()) {
- shallowCommits = new ArrayList<>();
- processShallow(shallowCommits, unshallowCommits, false);
+ if (mayHaveShallow) {
+ computeShallowsAndUnshallows(req,
+ shallowCommit -> shallowCommits.add(shallowCommit),
+ unshallowCommit -> unshallowCommits.add(unshallowCommit));
}
if (!req.getClientShallowCommits().isEmpty())
walk.assumeShallow(req.getClientShallowCommits());
@@ -1008,7 +998,7 @@ private void fetchV2() throws IOException {
}
if (req.wasDoneReceived() || okToGiveUp()) {
- if (shallowCommits != null) {
+ if (mayHaveShallow) {
if (sectionSent)
pckOut.writeDelim();
pckOut.writeString("shallow-info\n"); //$NON-NLS-1$
@@ -1038,7 +1028,8 @@ private void fetchV2() throws IOException {
pckOut.writeDelim();
pckOut.writeString("packfile\n"); //$NON-NLS-1$
sendPack(new PackStatistics.Accumulator(),
- req.getOptions().contains(OPTION_INCLUDE_TAG)
+ req,
+ req.getClientCapabilities().contains(OPTION_INCLUDE_TAG)
? db.getRefDatabase().getRefsByPrefix(R_TAGS)
: null,
unshallowCommits);
@@ -1092,6 +1083,7 @@ private List<String> getV2CapabilityAdvertisement() {
(transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "") + //$NON-NLS-1$
(advertiseRefInWant ? CAPABILITY_REF_IN_WANT + ' ' : "") + //$NON-NLS-1$
OPTION_SHALLOW);
+ caps.add(CAPABILITY_SERVER_OPTION);
return caps;
}
@@ -1140,28 +1132,29 @@ private static Set<ObjectId> refIdSet(Collection<Ref> refs) {
}
/*
- * Determines what "shallow" and "unshallow" lines to send to the user.
- * The information is written to shallowCommits (if not null) and
- * unshallowCommits, and also written to #pckOut (if writeToPckOut is
- * true).
+ * Determines what object ids must be marked as shallow or unshallow for the
+ * client.
*/
- private void processShallow(@Nullable List<ObjectId> shallowCommits,
- List<ObjectId> unshallowCommits,
- boolean writeToPckOut) throws IOException {
- if (options.contains(OPTION_DEEPEN_RELATIVE) ||
- shallowSince != 0 ||
- !deepenNotRefs.isEmpty()) {
- // TODO(jonathantanmy): Implement deepen-relative, deepen-since,
+ private void computeShallowsAndUnshallows(FetchRequest req,
+ IOConsumer<ObjectId> shallowFunc,
+ IOConsumer<ObjectId> unshallowFunc)
+ throws IOException {
+ if (req.getClientCapabilities().contains(OPTION_DEEPEN_RELATIVE)
+ || !req.getDeepenNotRefs().isEmpty()) {
+ // TODO(jonathantanmy): Implement deepen-relative
// and deepen-not.
throw new UnsupportedOperationException();
}
- int walkDepth = depth - 1;
+ int walkDepth = req.getDepth() == 0 ? Integer.MAX_VALUE
+ : req.getDepth() - 1;
try (DepthWalk.RevWalk depthWalk = new DepthWalk.RevWalk(
walk.getObjectReader(), walkDepth)) {
+ depthWalk.setDeepenSince(req.getDeepenSince());
+
// Find all the commits which will be shallow
- for (ObjectId o : wantIds) {
+ for (ObjectId o : req.getWantIds()) {
try {
depthWalk.markRoot(depthWalk.parseCommit(o));
} catch (IncorrectObjectTypeException notCommit) {
@@ -1173,32 +1166,21 @@ private void processShallow(@Nullable List<ObjectId> shallowCommits,
while ((o = depthWalk.next()) != null) {
DepthWalk.Commit c = (DepthWalk.Commit) o;
+ boolean isBoundary = (c.getDepth() == walkDepth) || c.isBoundary();
+
// Commits at the boundary which aren't already shallow in
// the client need to be marked as such
- if (c.getDepth() == walkDepth
- && !clientShallowCommits.contains(c)) {
- if (shallowCommits != null) {
- shallowCommits.add(c.copy());
- }
- if (writeToPckOut) {
- pckOut.writeString("shallow " + o.name()); //$NON-NLS-1$
- }
+ if (isBoundary && !req.getClientShallowCommits().contains(c)) {
+ shallowFunc.accept(c.copy());
}
// Commits not on the boundary which are shallow in the client
// need to become unshallowed
- if (c.getDepth() < walkDepth
- && clientShallowCommits.remove(c)) {
- unshallowCommits.add(c.copy());
- if (writeToPckOut) {
- pckOut.writeString("unshallow " + c.name()); //$NON-NLS-1$
- }
+ if (!isBoundary && req.getClientShallowCommits().remove(c)) {
+ unshallowFunc.accept(c.copy());
}
}
}
- if (writeToPckOut) {
- pckOut.end();
- }
}
/*
@@ -1358,67 +1340,6 @@ public OutputStream getMessageOutputStream() {
return msgOut;
}
- private void recvWants() throws IOException {
- boolean isFirst = true;
- boolean filterReceived = false;
- for (;;) {
- String line;
- try {
- line = pckIn.readString();
- } catch (EOFException eof) {
- if (isFirst)
- break;
- throw eof;
- }
-
- if (line == PacketLineIn.END)
- break;
-
- if (line.startsWith("deepen ")) { //$NON-NLS-1$
- depth = Integer.parseInt(line.substring(7));
- if (depth <= 0) {
- throw new PackProtocolException(
- MessageFormat.format(JGitText.get().invalidDepth,
- Integer.valueOf(depth)));
- }
- continue;
- }
-
- if (line.startsWith("shallow ")) { //$NON-NLS-1$
- clientShallowCommits.add(ObjectId.fromString(line.substring(8)));
- continue;
- }
-
- if (transferConfig.isAllowFilter()
- && line.startsWith(OPTION_FILTER + " ")) { //$NON-NLS-1$
- String arg = line.substring(OPTION_FILTER.length() + 1);
-
- if (filterReceived) {
- throw new PackProtocolException(JGitText.get().tooManyFilters);
- }
- filterReceived = true;
-
- filterBlobLimit = ProtocolV2Parser.filterLine(arg);
- continue;
- }
-
- if (!line.startsWith("want ") || line.length() < 45) //$NON-NLS-1$
- throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); //$NON-NLS-1$
-
- if (isFirst) {
- if (line.length() > 45) {
- FirstLine firstLine = new FirstLine(line);
- options = firstLine.getOptions();
- line = firstLine.getLine();
- } else
- options = Collections.emptySet();
- }
-
- wantIds.add(ObjectId.fromString(line.substring(5)));
- isFirst = false;
- }
- }
-
/**
* Returns the clone/fetch depth. Valid only after calling recvWants(). A
* depth of 1 means return only the wants.
@@ -1427,9 +1348,9 @@ private void recvWants() throws IOException {
* @since 4.0
*/
public int getDepth() {
- if (options == null)
+ if (currentRequest == null)
throw new RequestNotYetReadException();
- return depth;
+ return currentRequest.getDepth();
}
/**
@@ -1448,10 +1369,16 @@ public int getDepth() {
* @since 4.0
*/
public String getPeerUserAgent() {
- return UserAgent.getAgent(options, userAgent);
+ if (currentRequest == null) {
+ return userAgent;
+ }
+
+ return UserAgent.getAgent(currentRequest.getClientCapabilities(),
+ userAgent);
}
- private boolean negotiate(PackStatistics.Accumulator accumulator)
+ private boolean negotiate(FetchRequest req,
+ PackStatistics.Accumulator accumulator)
throws IOException {
okToGiveUp = Boolean.FALSE;
@@ -1467,7 +1394,7 @@ private boolean negotiate(PackStatistics.Accumulator accumulator)
// disconnected, and will try another request with actual want/have.
// Don't report the EOF here, its a bug in the protocol that the client
// just disconnects without sending an END.
- if (!biDirectionalPipe && depth > 0)
+ if (!biDirectionalPipe && req.getDepth() > 0)
return false;
throw eof;
}
@@ -1848,25 +1775,27 @@ private boolean wantSatisfied(RevObject want) throws IOException {
* Send the requested objects to the client.
*
* @param accumulator
- * where to write statistics about the content of the pack.
+ * where to write statistics about the content of the pack.
+ * @param req
+ * request in process
* @param allTags
- * refs to search for annotated tags to include in the pack
- * if the {@link #OPTION_INCLUDE_TAG} capability was
- * requested.
+ * refs to search for annotated tags to include in the pack if
+ * the {@link #OPTION_INCLUDE_TAG} capability was requested.
* @param unshallowCommits
- * shallow commits on the client that are now becoming
- * unshallow
+ * shallow commits on the client that are now becoming unshallow
* @throws IOException
- * if an error occured while generating or writing the pack.
+ * if an error occured while generating or writing the pack.
*/
private void sendPack(PackStatistics.Accumulator accumulator,
+ FetchRequest req,
@Nullable Collection<Ref> allTags,
List<ObjectId> unshallowCommits) throws IOException {
- final boolean sideband = options.contains(OPTION_SIDE_BAND)
- || options.contains(OPTION_SIDE_BAND_64K);
+ Set<String> caps = req.getClientCapabilities();
+ boolean sideband = caps.contains(OPTION_SIDE_BAND)
+ || caps.contains(OPTION_SIDE_BAND_64K);
if (sideband) {
try {
- sendPack(true, accumulator, allTags, unshallowCommits);
+ sendPack(true, req, accumulator, allTags, unshallowCommits);
} catch (ServiceMayNotContinueException noPack) {
// This was already reported on (below).
throw noPack;
@@ -1887,7 +1816,7 @@ private void sendPack(PackStatistics.Accumulator accumulator,
throw err;
}
} else {
- sendPack(false, accumulator, allTags, unshallowCommits);
+ sendPack(false, req, accumulator, allTags, unshallowCommits);
}
}
@@ -1911,21 +1840,22 @@ private boolean reportInternalServerErrorOverSideband() {
* Send the requested objects to the client.
*
* @param sideband
- * whether to wrap the pack in side-band pkt-lines,
- * interleaved with progress messages and errors.
+ * whether to wrap the pack in side-band pkt-lines, interleaved
+ * with progress messages and errors.
+ * @param req
+ * request being processed
* @param accumulator
- * where to write statistics about the content of the pack.
+ * where to write statistics about the content of the pack.
* @param allTags
- * refs to search for annotated tags to include in the pack
- * if the {@link #OPTION_INCLUDE_TAG} capability was
- * requested.
+ * refs to search for annotated tags to include in the pack if
+ * the {@link #OPTION_INCLUDE_TAG} capability was requested.
* @param unshallowCommits
- * shallow commits on the client that are now becoming
- * unshallow
+ * shallow commits on the client that are now becoming unshallow
* @throws IOException
- * if an error occured while generating or writing the pack.
+ * if an error occured while generating or writing the pack.
*/
private void sendPack(final boolean sideband,
+ FetchRequest req,
PackStatistics.Accumulator accumulator,
@Nullable Collection<Ref> allTags,
List<ObjectId> unshallowCommits) throws IOException {
@@ -1934,12 +1864,12 @@ private void sendPack(final boolean sideband,
if (sideband) {
int bufsz = SideBandOutputStream.SMALL_BUF;
- if (options.contains(OPTION_SIDE_BAND_64K))
+ if (req.getClientCapabilities().contains(OPTION_SIDE_BAND_64K))
bufsz = SideBandOutputStream.MAX_BUF;
packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA,
bufsz, rawOut);
- if (!options.contains(OPTION_NO_PROGRESS)) {
+ if (!req.getClientCapabilities().contains(OPTION_NO_PROGRESS)) {
msgOut = new SideBandOutputStream(
SideBandOutputStream.CH_PROGRESS, bufsz, rawOut);
pm = new SideBandProgressMonitor(msgOut);
@@ -1975,17 +1905,20 @@ private void sendPack(final boolean sideband,
accumulator);
try {
pw.setIndexDisabled(true);
- if (filterBlobLimit >= 0) {
- pw.setFilterBlobLimit(filterBlobLimit);
+ if (req.getFilterBlobLimit() >= 0) {
+ pw.setFilterBlobLimit(req.getFilterBlobLimit());
pw.setUseCachedPacks(false);
} else {
pw.setUseCachedPacks(true);
}
- pw.setUseBitmaps(depth == 0 && clientShallowCommits.isEmpty());
- pw.setClientShallowCommits(clientShallowCommits);
+ pw.setUseBitmaps(
+ req.getDepth() == 0
+ && req.getClientShallowCommits().isEmpty());
+ pw.setClientShallowCommits(req.getClientShallowCommits());
pw.setReuseDeltaCommits(true);
- pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA));
- pw.setThin(options.contains(OPTION_THIN_PACK));
+ pw.setDeltaBaseAsOffset(
+ req.getClientCapabilities().contains(OPTION_OFS_DELTA));
+ pw.setThin(req.getClientCapabilities().contains(OPTION_THIN_PACK));
pw.setReuseValidatingObjects(false);
// Objects named directly by references go at the beginning
@@ -2004,14 +1937,18 @@ else if (ref.getName().startsWith(Constants.R_HEADS))
}
RevWalk rw = walk;
- if (depth > 0) {
- pw.setShallowPack(depth, unshallowCommits);
- rw = new DepthWalk.RevWalk(walk.getObjectReader(), depth - 1);
- rw.assumeShallow(clientShallowCommits);
+ if (req.getDepth() > 0 || req.getDeepenSince() != 0) {
+ int walkDepth = req.getDepth() == 0 ? Integer.MAX_VALUE
+ : req.getDepth() - 1;
+ pw.setShallowPack(req.getDepth(), unshallowCommits);
+ rw = new DepthWalk.RevWalk(walk.getObjectReader(), walkDepth);
+ ((DepthWalk.RevWalk) rw).setDeepenSince(req.getDeepenSince());
+ rw.assumeShallow(req.getClientShallowCommits());
}
if (wantAll.isEmpty()) {
- pw.preparePack(pm, wantIds, commonBase, clientShallowCommits);
+ pw.preparePack(pm, wantIds, commonBase,
+ req.getClientShallowCommits());
} else {
walk.reset();
@@ -2020,7 +1957,8 @@ else if (ref.getName().startsWith(Constants.R_HEADS))
rw = ow;
}
- if (options.contains(OPTION_INCLUDE_TAG) && allTags != null) {
+ if (req.getClientCapabilities().contains(OPTION_INCLUDE_TAG)
+ && allTags != null) {
for (Ref ref : allTags) {
ObjectId objectId = ref.getObjectId();
if (objectId == null) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
index 24b9ac0..3d25c23 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
@@ -46,6 +46,8 @@
package org.eclipse.jgit.treewalk;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -412,7 +414,7 @@ public long getLastModified() {
public InputStream openInputStream() throws IOException {
if (attributes.isSymbolicLink()) {
return new ByteArrayInputStream(fs.readSymLink(getFile())
- .getBytes(Constants.CHARACTER_ENCODING));
+ .getBytes(UTF_8));
} else {
return new FileInputStream(getFile());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
index e5c2922..7f0308f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -43,6 +43,8 @@
package org.eclipse.jgit.util;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
@@ -1172,7 +1174,7 @@ public int runProcess(ProcessBuilder processBuilder,
OutputStream outRedirect, OutputStream errRedirect, String stdinArgs)
throws IOException, InterruptedException {
InputStream in = (stdinArgs == null) ? null : new ByteArrayInputStream(
- stdinArgs.getBytes(Constants.CHARACTER_ENCODING));
+ stdinArgs.getBytes(UTF_8));
return runProcess(processBuilder, outRedirect, errRedirect, in);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
index 6f92b37..9190a59 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
@@ -44,7 +44,7 @@
package org.eclipse.jgit.util;
-import static org.eclipse.jgit.lib.Constants.CHARACTER_ENCODING;
+import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -181,7 +181,7 @@ public static void encode(StringBuilder urlstr, String key) {
if (key == null || key.length() == 0)
return;
try {
- urlstr.append(URLEncoder.encode(key, CHARACTER_ENCODING));
+ urlstr.append(URLEncoder.encode(key, UTF_8.name()));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(JGitText.get().couldNotURLEncodeToUTF8, e);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java
index 6d60ef3..96636b7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java
@@ -152,7 +152,8 @@ public ObjectLoader applySmudgeFilter(Repository db,
* @param outputStream
* @return a {@link PrePushHook} implementation or <code>null</code>
*/
- public @Nullable PrePushHook getPrePushHook(Repository repo,
+ @Nullable
+ public PrePushHook getPrePushHook(Repository repo,
PrintStream outputStream) {
return null;
}
@@ -163,7 +164,8 @@ public ObjectLoader applySmudgeFilter(Repository db,
*
* @return a command to install LFS support.
*/
- public @Nullable LfsInstallCommand getInstallCommand() {
+ @Nullable
+ public LfsInstallCommand getInstallCommand() {
return null;
}
@@ -294,6 +296,11 @@ public int read() throws IOException {
return stream.read();
}
+ @Override
+ public int read(byte b[], int off, int len) throws IOException {
+ return stream.read(b, off, len);
+ }
+
/**
* @return the length of the stream
*/
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
index 28f406a..bbb1645 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
@@ -729,7 +729,8 @@ public static final IntList lineMapOrBinary(byte[] buf, int ptr, int end)
return map;
}
- private static @Nullable IntList lineMapOrNull(byte[] buf, int ptr, int end) {
+ @Nullable
+ private static IntList lineMapOrNull(byte[] buf, int ptr, int end) {
// Experimentally derived from multiple source repositories
// the average number of bytes/line is 36. Its a rough guess
// to initially size our map close to the target.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java
index 822961f..d7c6bec 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/EolStreamTypeUtil.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015, Ivan Motsch <ivan.motsch@bsiag.com>
+ * 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
@@ -49,6 +50,7 @@
import org.eclipse.jgit.lib.CoreConfig.EolStreamType;
import org.eclipse.jgit.treewalk.TreeWalk.OperationType;
import org.eclipse.jgit.treewalk.WorkingTreeOptions;
+import org.eclipse.jgit.util.SystemReader;
/**
* Utility used to create input and output stream wrappers for
@@ -57,7 +59,6 @@
* @since 4.3
*/
public final class EolStreamTypeUtil {
- private static final boolean FORCE_EOL_LF_ON_CHECKOUT = false;
private EolStreamTypeUtil() {
}
@@ -164,11 +165,11 @@ private static EolStreamType checkInStreamType(WorkingTreeOptions options,
// old git system
if (attrs.isSet("crlf")) {//$NON-NLS-1$
- return EolStreamType.TEXT_LF;
+ return EolStreamType.TEXT_LF; // Same as isSet("text")
} else if (attrs.isUnset("crlf")) {//$NON-NLS-1$
- return EolStreamType.DIRECT;
+ return EolStreamType.DIRECT; // Same as isUnset("text")
} else if ("input".equals(attrs.getValue("crlf"))) {//$NON-NLS-1$ //$NON-NLS-2$
- return EolStreamType.TEXT_LF;
+ return EolStreamType.TEXT_LF; // Same as eol=lf
}
// new git system
@@ -196,6 +197,28 @@ private static EolStreamType checkInStreamType(WorkingTreeOptions options,
return EolStreamType.DIRECT;
}
+ private static EolStreamType getOutputFormat(WorkingTreeOptions options) {
+ switch (options.getAutoCRLF()) {
+ case TRUE:
+ return EolStreamType.TEXT_CRLF;
+ default:
+ // no decision
+ }
+ switch (options.getEOL()) {
+ case CRLF:
+ return EolStreamType.TEXT_CRLF;
+ case NATIVE:
+ if (SystemReader.getInstance().isWindows()) {
+ return EolStreamType.TEXT_CRLF;
+ }
+ return EolStreamType.TEXT_LF;
+ case LF:
+ default:
+ break;
+ }
+ return EolStreamType.DIRECT;
+ }
+
private static EolStreamType checkOutStreamType(WorkingTreeOptions options,
Attributes attrs) {
if (attrs.isUnset("text")) {//$NON-NLS-1$
@@ -205,57 +228,35 @@ private static EolStreamType checkOutStreamType(WorkingTreeOptions options,
// old git system
if (attrs.isSet("crlf")) {//$NON-NLS-1$
- return FORCE_EOL_LF_ON_CHECKOUT ? EolStreamType.TEXT_LF
- : EolStreamType.DIRECT;
+ return getOutputFormat(options); // Same as isSet("text")
} else if (attrs.isUnset("crlf")) {//$NON-NLS-1$
- return EolStreamType.DIRECT;
+ return EolStreamType.DIRECT; // Same as isUnset("text")
} else if ("input".equals(attrs.getValue("crlf"))) {//$NON-NLS-1$ //$NON-NLS-2$
- return EolStreamType.DIRECT;
+ return EolStreamType.DIRECT; // Same as eol=lf
}
// new git system
String eol = attrs.getValue("eol"); //$NON-NLS-1$
- if (eol != null && "crlf".equals(eol)) //$NON-NLS-1$
- return EolStreamType.TEXT_CRLF;
- if (eol != null && "lf".equals(eol)) //$NON-NLS-1$
- return FORCE_EOL_LF_ON_CHECKOUT ? EolStreamType.TEXT_LF
- : EolStreamType.DIRECT;
-
- if (attrs.isSet("text")) { //$NON-NLS-1$
- switch (options.getAutoCRLF()) {
- case TRUE:
+ if (eol != null) {
+ if ("crlf".equals(eol)) {//$NON-NLS-1$
return EolStreamType.TEXT_CRLF;
- default:
- // no decision
- }
- switch (options.getEOL()) {
- case CRLF:
- return EolStreamType.TEXT_CRLF;
- case LF:
- return FORCE_EOL_LF_ON_CHECKOUT ? EolStreamType.TEXT_LF
- : EolStreamType.DIRECT;
- case NATIVE:
- default:
+ } else if ("lf".equals(eol)) { //$NON-NLS-1$
return EolStreamType.DIRECT;
}
}
+ if (attrs.isSet("text")) { //$NON-NLS-1$
+ return getOutputFormat(options);
+ }
if ("auto".equals(attrs.getValue("text"))) { //$NON-NLS-1$ //$NON-NLS-2$
- switch (options.getAutoCRLF()) {
- case TRUE:
+ EolStreamType basic = getOutputFormat(options);
+ switch (basic) {
+ case TEXT_CRLF:
return EolStreamType.AUTO_CRLF;
+ case TEXT_LF:
+ return EolStreamType.AUTO_LF;
default:
- // no decision
- }
- switch (options.getEOL()) {
- case CRLF:
- return EolStreamType.AUTO_CRLF;
- case LF:
- return FORCE_EOL_LF_ON_CHECKOUT ? EolStreamType.TEXT_LF
- : EolStreamType.DIRECT;
- case NATIVE:
- default:
- return EolStreamType.DIRECT;
+ return basic;
}
}
diff --git a/pom.xml b/pom.xml
index 41bab39..dc90f06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,7 +51,7 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
<packaging>pom</packaging>
- <version>5.1.4-SNAPSHOT</version>
+ <version>5.2.0-SNAPSHOT</version>
<name>JGit - Parent</name>
<url>${jgit-url}</url>
@@ -216,9 +216,11 @@
<maven-javadoc-plugin-version>3.0.1</maven-javadoc-plugin-version>
<tycho-extras-version>1.2.0</tycho-extras-version>
<gson-version>2.8.2</gson-version>
- <spotbugs-maven-plugin-version>3.1.6</spotbugs-maven-plugin-version>
- <maven-surefire-report-plugin-version>2.21.0</maven-surefire-report-plugin-version>
+ <spotbugs-maven-plugin-version>3.1.7</spotbugs-maven-plugin-version>
+ <maven-surefire-version>2.22.1</maven-surefire-version>
<maven-compiler-plugin-version>3.8.0</maven-compiler-plugin-version>
+ <maven-project-info-reports-plugin-version>3.0.0</maven-project-info-reports-plugin-version>
+ <maven-jxr-plugin-version>3.0.0</maven-jxr-plugin-version>
<!-- Properties to enable jacoco code coverage analysis -->
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
@@ -275,7 +277,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>3.1.1</version>
+ <version>3.2.0</version>
</plugin>
<plugin>
@@ -305,7 +307,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.21.0</version>
+ <version>${maven-surefire-version}</version>
<configuration>
<forkCount>${test-fork-count}</forkCount>
<reuseForks>true</reuseForks>
@@ -376,7 +378,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.1</version>
+ <version>0.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -386,24 +388,24 @@
<dependency><!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
- <version>3.1.0</version>
+ <version>3.2.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>${maven-surefire-report-plugin-version}</version>
+ <version>${maven-surefire-version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
- <version>2.5</version>
+ <version>${maven-jxr-plugin-version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.9</version>
+ <version>${maven-project-info-reports-plugin-version}</version>
</plugin>
</plugins>
</pluginManagement>
@@ -412,7 +414,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
- <version>3.0.0-M1</version>
+ <version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-maven</id>
@@ -560,7 +562,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
- <version>2.5</version>
+ <version>${maven-jxr-plugin-version}</version>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
@@ -570,7 +572,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>${maven-surefire-report-plugin-version}</version>
+ <version>${maven-surefire-version}</version>
<configuration>
<aggregate>true</aggregate>
<alwaysGenerateSurefireReport>false</alwaysGenerateSurefireReport>
@@ -582,7 +584,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.9</version>
+ <version>${maven-project-info-reports-plugin-version}</version>
<reportSets>
<reportSet>
<reports>
@@ -798,7 +800,7 @@
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
- <version>2.3.1</version>
+ <version>2.3.2</version>
</dependency>
</dependencies>
</plugin>
diff --git a/tools/BUILD b/tools/BUILD
index e69de29..b8a621f 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -0,0 +1,107 @@
+load(
+ "@bazel_tools//tools/jdk:default_java_toolchain.bzl",
+ "JDK9_JVM_OPTS",
+ "default_java_toolchain",
+)
+
+default_java_toolchain(
+ name = "error_prone_warnings_toolchain",
+ bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath9.jar"],
+ jvm_opts = JDK9_JVM_OPTS,
+ package_configuration = [
+ ":error_prone",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+# This EP warnings list borrowed from here:
+# https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl
+java_package_configuration(
+ name = "error_prone",
+ javacopts = [
+ "-XepDisableWarningsInGeneratedCode",
+ "-Xep:MissingCasesInEnumSwitch:ERROR",
+ "-Xep:ReferenceEquality:WARN",
+ "-Xep:StringEquality:WARN",
+ "-Xep:WildcardImport:WARN",
+ "-Xep:AmbiguousMethodReference:WARN",
+ "-Xep:BadAnnotationImplementation:WARN",
+ "-Xep:BadComparable:WARN",
+ "-Xep:BoxedPrimitiveConstructor:ERROR",
+ "-Xep:CannotMockFinalClass:WARN",
+ "-Xep:ClassCanBeStatic:WARN",
+ "-Xep:ClassNewInstance:WARN",
+ "-Xep:DefaultCharset:ERROR",
+ "-Xep:DoubleCheckedLocking:WARN",
+ "-Xep:ElementsCountedInLoop:WARN",
+ "-Xep:EqualsHashCode:WARN",
+ "-Xep:EqualsIncompatibleType:WARN",
+ "-Xep:ExpectedExceptionChecker:ERROR",
+ "-Xep:Finally:WARN",
+ "-Xep:FloatingPointLiteralPrecision:WARN",
+ "-Xep:FragmentInjection:WARN",
+ "-Xep:FragmentNotInstantiable:WARN",
+ "-Xep:FunctionalInterfaceClash:WARN",
+ "-Xep:FutureReturnValueIgnored:WARN",
+ "-Xep:GetClassOnEnum:WARN",
+ "-Xep:ImmutableAnnotationChecker:WARN",
+ "-Xep:ImmutableEnumChecker:WARN",
+ "-Xep:IncompatibleModifiers:WARN",
+ "-Xep:InjectOnConstructorOfAbstractClass:WARN",
+ "-Xep:InputStreamSlowMultibyteRead:WARN",
+ "-Xep:IterableAndIterator:WARN",
+ "-Xep:JUnit3FloatingPointComparisonWithoutDelta:WARN",
+ "-Xep:JUnitAmbiguousTestClass:WARN",
+ "-Xep:LiteralClassName:WARN",
+ "-Xep:MissingFail:ERROR",
+ "-Xep:MissingOverride:WARN",
+ "-Xep:MutableConstantField:WARN",
+ "-Xep:NarrowingCompoundAssignment:WARN",
+ "-Xep:NonAtomicVolatileUpdate:WARN",
+ "-Xep:NonOverridingEquals:WARN",
+ "-Xep:NullableConstructor:WARN",
+ "-Xep:NullablePrimitive:WARN",
+ "-Xep:NullableVoid:WARN",
+ "-Xep:OperatorPrecedence:WARN",
+ "-Xep:OverridesGuiceInjectableMethod:WARN",
+ "-Xep:PreconditionsInvalidPlaceholder:WARN",
+ "-Xep:ProtoFieldPreconditionsCheckNotNull:WARN",
+ "-Xep:ProtocolBufferOrdinal:WARN",
+ "-Xep:RequiredModifiers:WARN",
+ "-Xep:ShortCircuitBoolean:WARN",
+ "-Xep:SimpleDateFormatConstant:WARN",
+ "-Xep:StaticGuardedByInstance:WARN",
+ "-Xep:SynchronizeOnNonFinalField:WARN",
+ "-Xep:TruthConstantAsserts:WARN",
+ "-Xep:TypeParameterShadowing:WARN",
+ "-Xep:TypeParameterUnusedInFormals:WARN",
+ "-Xep:URLEqualsHashCode:WARN",
+ "-Xep:UnsynchronizedOverridesSynchronized:WARN",
+ "-Xep:WaitNotInLoop:WARN",
+ ],
+ packages = ["error_prone_packages"],
+)
+
+package_group(
+ name = "error_prone_packages",
+ packages = [
+ "//org.eclipse.jgit/...",
+ "//org.eclipse.jgit.ant/...",
+ "//org.eclipse.jgit.ant.test/...",
+ "//org.eclipse.jgit.archive/...",
+ "//org.eclipse.jgit.http.apache/...",
+ "//org.eclipse.jgit.http.server/...",
+ "//org.eclipse.jgit.http.test/...",
+ "//org.eclipse.jgit.junit/...",
+ "//org.eclipse.jgit.junit.http/...",
+ "//org.eclipse.jgit.lfs/...",
+ "//org.eclipse.jgit.lfs.server/...",
+ "//org.eclipse.jgit.lfs.server.test/...",
+ "//org.eclipse.jgit.lfs.test/...",
+ "//org.eclipse.jgit.packaging/...",
+ "//org.eclipse.jgit.pgm/...",
+ "//org.eclipse.jgit.pgm.test/...",
+ "//org.eclipse.jgit.test/...",
+ "//org.eclipse.jgit.ui/...",
+ ],
+)