Merge branch 'master' into stable-5.4

* master:
  ReachabilityCheckers: @since 5.4
  Update Orbit to S20190521195709 for 2019-06 M3
  Tune max heap size for tests
  GPG: check that the key found is a signing key
  GPG: use key fingerprint suffix to compare id for signing key
  Recognize ReachabilityCheckerTestCase as helper
  UploadPack: restore inadvertently deleted line
  UploadPack: Use reachability checker to validate non-advertised wants
  Bazel: Simplify names of bouncy castle libraries
  Convert to lambda or member reference
  BitmappedReachabilityChecker: Reachability check using bitmaps
  BitmapCalculator: Get the reachability bitmap of a commit
  ReachabilityChecker: Default implementation with a RevWalk

Change-Id: I323c460853230abcffa94c4f34f15dbaff8c330c
This commit is contained in:
Matthias Sohn 2019-05-22 19:37:40 +02:00
commit bed7a45fb5
112 changed files with 1670 additions and 1237 deletions

View File

@ -215,21 +215,21 @@ maven_jar(
BOUNCYCASTLE_VER = "1.60" BOUNCYCASTLE_VER = "1.60"
maven_jar( maven_jar(
name = "bcpg-jdk15on", name = "bcpg",
artifact = "org.bouncycastle:bcpg-jdk15on:" + BOUNCYCASTLE_VER, artifact = "org.bouncycastle:bcpg-jdk15on:" + BOUNCYCASTLE_VER,
sha1 = "13c7a199c484127daad298996e95818478431a2c", sha1 = "13c7a199c484127daad298996e95818478431a2c",
src_sha1 = "edcd9e86d95e39b4da39bb295efd93bc4f56266e", src_sha1 = "edcd9e86d95e39b4da39bb295efd93bc4f56266e",
) )
maven_jar( maven_jar(
name = "bcprov-jdk15on", name = "bcprov",
artifact = "org.bouncycastle:bcprov-jdk15on:" + BOUNCYCASTLE_VER, artifact = "org.bouncycastle:bcprov-jdk15on:" + BOUNCYCASTLE_VER,
sha1 = "bd47ad3bd14b8e82595c7adaa143501e60842a84", sha1 = "bd47ad3bd14b8e82595c7adaa143501e60842a84",
src_sha1 = "7c57a4d13fe53d9abb967bba600dd0b293dafd6a", src_sha1 = "7c57a4d13fe53d9abb967bba600dd0b293dafd6a",
) )
maven_jar( maven_jar(
name = "bcpkix-jdk15on", name = "bcpkix",
artifact = "org.bouncycastle:bcpkix-jdk15on:" + BOUNCYCASTLE_VER, artifact = "org.bouncycastle:bcpkix-jdk15on:" + BOUNCYCASTLE_VER,
sha1 = "d0c46320fbc07be3a24eb13a56cee4e3d38e0c75", sha1 = "d0c46320fbc07be3a24eb13a56cee4e3d38e0c75",
src_sha1 = "a25f041293f401af08efba63ff4bbdce98134a03", src_sha1 = "a25f041293f401af08efba63ff4bbdce98134a03",

View File

@ -153,7 +153,7 @@ java_library(
"//org.eclipse.jgit:__pkg__", "//org.eclipse.jgit:__pkg__",
"//org.eclipse.jgit.test:__pkg__", "//org.eclipse.jgit.test:__pkg__",
], ],
exports = ["@bcpg-jdk15on//jar"], exports = ["@bcpg//jar"],
) )
java_library( java_library(
@ -162,7 +162,7 @@ java_library(
"//org.eclipse.jgit:__pkg__", "//org.eclipse.jgit:__pkg__",
"//org.eclipse.jgit.test:__pkg__", "//org.eclipse.jgit.test:__pkg__",
], ],
exports = ["@bcprov-jdk15on//jar"], exports = ["@bcprov//jar"],
) )
java_library( java_library(
@ -171,7 +171,7 @@ java_library(
"//org.eclipse.jgit:__pkg__", "//org.eclipse.jgit:__pkg__",
"//org.eclipse.jgit.test:__pkg__", "//org.eclipse.jgit.test:__pkg__",
], ],
exports = ["@bcpkix-jdk15on//jar"], exports = ["@bcpkix//jar"],
) )
java_library( java_library(

View File

@ -105,7 +105,7 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<argLine>@{argLine} -Xmx256m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine> <argLine>@{argLine} -Xmx512m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -47,7 +47,6 @@
import java.io.IOException; import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -140,14 +139,10 @@ public void destroy() {
@Override @Override
protected void service(HttpServletRequest req, HttpServletResponse res) protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException { throws ServletException, IOException {
filter.doFilter(req, res, new FilterChain() { filter.doFilter(req, res,
@Override (ServletRequest request, ServletResponse response) -> {
public void doFilter(ServletRequest request, ((HttpServletResponse) response).sendError(SC_NOT_FOUND);
ServletResponse response) throws IOException, });
ServletException {
((HttpServletResponse) response).sendError(SC_NOT_FOUND);
}
});
} }
/** /**

View File

@ -139,7 +139,7 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<argLine>@{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx300m</argLine> <argLine>@{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx512m</argLine>
<includes> <includes>
<include>**/*Test.java</include> <include>**/*Test.java</include>
<include>**/*Tests.java</include> <include>**/*Tests.java</include>

View File

@ -69,7 +69,6 @@
import org.eclipse.jgit.transport.RemoteRefUpdate; import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.Before; import org.junit.Before;
@ -90,18 +89,13 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git"); ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet(); GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() { gs.setRepositoryResolver((HttpServletRequest req, String name) -> {
@Override if (!name.equals(srcName)) {
public Repository open(HttpServletRequest req, String name) throw new RepositoryNotFoundException(name);
throws RepositoryNotFoundException,
ServiceNotEnabledException {
if (!name.equals(srcName))
throw new RepositoryNotFoundException(name);
final Repository db = src.getRepository();
db.incrementOpen();
return db;
} }
final Repository db = src.getRepository();
db.incrementOpen();
return db;
}); });
gs.setReceivePackFactory(new DefaultReceivePackFactory() { gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override @Override

View File

@ -75,7 +75,6 @@
import org.eclipse.jgit.transport.RemoteRefUpdate; import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.Before; import org.junit.Before;
@ -117,18 +116,13 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git"); ServletContextHandler app = server.addContext("/git");
gs = new GitServlet(); gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() { gs.setRepositoryResolver((HttpServletRequest req, String name) -> {
@Override if (!name.equals(repoName)) {
public Repository open(HttpServletRequest req, String name) throw new RepositoryNotFoundException(name);
throws RepositoryNotFoundException,
ServiceNotEnabledException {
if (!name.equals(repoName))
throw new RepositoryNotFoundException(name);
final Repository db = srv.getRepository();
db.incrementOpen();
return db;
} }
final Repository db = srv.getRepository();
db.incrementOpen();
return db;
}); });
gs.setReceivePackFactory(new DefaultReceivePackFactory() { gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override @Override
@ -179,12 +173,8 @@ public void testRuntimeExceptionInPreReceiveHook() throws Exception {
maxPackSize = 0; maxPackSize = 0;
postHook = null; postHook = null;
preHook = new PreReceiveHook() { preHook = (ReceivePack rp, Collection<ReceiveCommand> commands) -> {
@Override throw new IllegalStateException();
public void onPreReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
throw new IllegalStateException();
}
}; };
try (Transport t = Transport.open(clientRepo, srvURI)) { try (Transport t = Transport.open(clientRepo, srvURI)) {
@ -263,15 +253,11 @@ public void testUnpackErrorWithSubsequentExceptionInPostReceiveHook()
maxPackSize = 100; maxPackSize = 100;
// this PostReceiveHook when called after an unsuccesfull unpack will // this PostReceiveHook when called after an unsuccesfull unpack will
// lead to an IllegalStateException // lead to an IllegalStateException
postHook = new PostReceiveHook() { postHook = (ReceivePack rp, Collection<ReceiveCommand> commands) -> {
@Override // the maxPackSize setting caused that the packfile couldn't be
public void onPostReceive(ReceivePack rp, // saved to disk. Calling getPackSize() now will lead to a
Collection<ReceiveCommand> commands) { // IllegalStateException.
// the maxPackSize setting caused that the packfile couldn't be rp.getPackSize();
// saved to disk. Calling getPackSize() now will lead to a
// IllegalStateException.
rp.getPackSize();
}
}; };
try (Transport t = Transport.open(clientRepo, srvURI)) { try (Transport t = Transport.open(clientRepo, srvURI)) {

View File

@ -70,14 +70,12 @@
import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.PreReceiveHook;
import org.eclipse.jgit.transport.PushResult; import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.ReceiveCommand; import org.eclipse.jgit.transport.ReceiveCommand;
import org.eclipse.jgit.transport.ReceivePack; import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.RemoteRefUpdate; import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.Before; import org.junit.Before;
@ -98,18 +96,13 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git"); ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet(); GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() { gs.setRepositoryResolver((HttpServletRequest req, String name) -> {
@Override if (!name.equals(srcName)) {
public Repository open(HttpServletRequest req, String name) throw new RepositoryNotFoundException(name);
throws RepositoryNotFoundException,
ServiceNotEnabledException {
if (!name.equals(srcName))
throw new RepositoryNotFoundException(name);
final Repository db = src.getRepository();
db.incrementOpen();
return db;
} }
final Repository db = src.getRepository();
db.incrementOpen();
return db;
}); });
gs.setReceivePackFactory(new DefaultReceivePackFactory() { gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override @Override
@ -117,14 +110,11 @@ public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException, throws ServiceNotEnabledException,
ServiceNotAuthorizedException { ServiceNotAuthorizedException {
ReceivePack recv = super.create(req, db); ReceivePack recv = super.create(req, db);
recv.setPreReceiveHook(new PreReceiveHook() { recv.setPreReceiveHook((ReceivePack rp,
@Override Collection<ReceiveCommand> commands) -> {
public void onPreReceive(ReceivePack rp, rp.sendMessage("message line 1");
Collection<ReceiveCommand> commands) { rp.sendError("no soup for you!");
rp.sendMessage("message line 1"); rp.sendMessage("come back next year!");
rp.sendError("no soup for you!");
rp.sendMessage("come back next year!");
}
}); });
return recv; return recv;
} }

View File

@ -87,8 +87,6 @@
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.eclipse.jgit.transport.http.HttpConnection; import org.eclipse.jgit.transport.http.HttpConnection;
import org.eclipse.jgit.transport.http.JDKHttpConnectionFactory; import org.eclipse.jgit.transport.http.JDKHttpConnectionFactory;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -141,18 +139,13 @@ private ServletContextHandler dumb(String path) {
private ServletContextHandler smart(String path) { private ServletContextHandler smart(String path) {
GitServlet gs = new GitServlet(); GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() { gs.setRepositoryResolver((HttpServletRequest req, String name) -> {
@Override final Repository db = remoteRepository.getRepository();
public Repository open(HttpServletRequest req, String name) if (!name.equals(nameOf(db))) {
throws RepositoryNotFoundException, throw new RepositoryNotFoundException(name);
ServiceNotEnabledException {
final Repository db = remoteRepository.getRepository();
if (!name.equals(nameOf(db)))
throw new RepositoryNotFoundException(name);
db.incrementOpen();
return db;
} }
db.incrementOpen();
return db;
}); });
ServletContextHandler ctx = server.addContext(path); ServletContextHandler ctx = server.addContext(path);

View File

@ -63,14 +63,12 @@
import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.PostReceiveHook;
import org.eclipse.jgit.transport.PushResult; import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.ReceiveCommand; import org.eclipse.jgit.transport.ReceiveCommand;
import org.eclipse.jgit.transport.ReceivePack; import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.RemoteRefUpdate; import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.Before; import org.junit.Before;
@ -93,18 +91,13 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git"); ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet(); GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() { gs.setRepositoryResolver((HttpServletRequest req, String name) -> {
@Override if (!name.equals(srcName)) {
public Repository open(HttpServletRequest req, String name) throw new RepositoryNotFoundException(name);
throws RepositoryNotFoundException,
ServiceNotEnabledException {
if (!name.equals(srcName))
throw new RepositoryNotFoundException(name);
final Repository db = src.getRepository();
db.incrementOpen();
return db;
} }
final Repository db = src.getRepository();
db.incrementOpen();
return db;
}); });
gs.setReceivePackFactory(new DefaultReceivePackFactory() { gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override @Override
@ -112,13 +105,9 @@ public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException, throws ServiceNotEnabledException,
ServiceNotAuthorizedException { ServiceNotAuthorizedException {
ReceivePack recv = super.create(req, db); ReceivePack recv = super.create(req, db);
recv.setPostReceiveHook(new PostReceiveHook() { recv.setPostReceiveHook((ReceivePack rp,
Collection<ReceiveCommand> commands) -> {
@Override packSize = rp.getPackSize();
public void onPostReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
packSize = rp.getPackSize();
}
}); });
return recv; return recv;
} }

View File

@ -71,8 +71,6 @@
import org.eclipse.jgit.transport.PacketLineIn; import org.eclipse.jgit.transport.PacketLineIn;
import org.eclipse.jgit.transport.PacketLineOut; import org.eclipse.jgit.transport.PacketLineOut;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.NB;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -94,18 +92,13 @@ public void setUp() throws Exception {
ServletContextHandler app = server.addContext("/git"); ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet(); GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() { gs.setRepositoryResolver((HttpServletRequest req, String name) -> {
@Override if (!name.equals(srcName)) {
public Repository open(HttpServletRequest req, String name) throw new RepositoryNotFoundException(name);
throws RepositoryNotFoundException,
ServiceNotEnabledException {
if (!name.equals(srcName))
throw new RepositoryNotFoundException(name);
final Repository db = src.getRepository();
db.incrementOpen();
return db;
} }
final Repository db = src.getRepository();
db.incrementOpen();
return db;
}); });
app.addServlet(new ServletHolder(gs), "/*"); app.addServlet(new ServletHolder(gs), "/*");

View File

@ -124,9 +124,6 @@
import org.eclipse.jgit.transport.http.HttpConnectionFactory; import org.eclipse.jgit.transport.http.HttpConnectionFactory;
import org.eclipse.jgit.transport.http.JDKHttpConnectionFactory; import org.eclipse.jgit.transport.http.JDKHttpConnectionFactory;
import org.eclipse.jgit.transport.http.apache.HttpClientConnectionFactory; import org.eclipse.jgit.transport.http.apache.HttpClientConnectionFactory;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.transport.resolver.UploadPackFactory;
import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.HttpSupport; import org.eclipse.jgit.util.HttpSupport;
import org.eclipse.jgit.util.SystemReader; import org.eclipse.jgit.util.SystemReader;
@ -192,18 +189,13 @@ public void setUp() throws Exception {
ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, true); ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, true);
GitServlet gs = new GitServlet(); GitServlet gs = new GitServlet();
gs.setUploadPackFactory(new UploadPackFactory<HttpServletRequest>() { gs.setUploadPackFactory((HttpServletRequest req, Repository db) -> {
@Override DefaultUploadPackFactory f = new DefaultUploadPackFactory();
public UploadPack create(HttpServletRequest req, Repository db) UploadPack up = f.create(req, db);
throws ServiceNotEnabledException, if (advertiseRefsHook != null) {
ServiceNotAuthorizedException { up.setAdvertiseRefsHook(advertiseRefsHook);
DefaultUploadPackFactory f = new DefaultUploadPackFactory();
UploadPack up = f.create(req, db);
if (advertiseRefsHook != null) {
up.setAdvertiseRefsHook(advertiseRefsHook);
}
return up;
} }
return up;
}); });
ServletContextHandler app = addNormalContext(gs, src, srcName); ServletContextHandler app = addNormalContext(gs, src, srcName);

View File

@ -54,8 +54,6 @@
import org.eclipse.jgit.http.server.GitServlet; import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.resolver.RepositoryResolver;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
/** /**
* Simple http server for testing http access to Git repositories. * Simple http server for testing http access to Git repositories.
@ -136,17 +134,12 @@ public URIish getSecureUri() {
private ServletContextHandler smart(String path) { private ServletContextHandler smart(String path) {
GitServlet gs = new GitServlet(); GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() { gs.setRepositoryResolver((HttpServletRequest req, String name) -> {
@Override if (!name.equals(nameOf(db))) {
public Repository open(HttpServletRequest req, String name) throw new RepositoryNotFoundException(name);
throws RepositoryNotFoundException,
ServiceNotEnabledException {
if (!name.equals(nameOf(db)))
throw new RepositoryNotFoundException(name);
db.incrementOpen();
return db;
} }
db.incrementOpen();
return db;
}); });
ServletContextHandler ctx = server.addContext(path); ServletContextHandler ctx = server.addContext(path);

View File

@ -171,22 +171,20 @@ public long getCurrentTime() {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public MonotonicClock getClock() { public MonotonicClock getClock() {
return new MonotonicClock() { return () -> {
@Override long t = getCurrentTime();
public ProposedTimestamp propose() { return new ProposedTimestamp() {
long t = getCurrentTime();
return new ProposedTimestamp() {
@Override
public long read(TimeUnit unit) {
return unit.convert(t, TimeUnit.MILLISECONDS);
}
@Override @Override
public void blockUntil(Duration maxWait) { public long read(TimeUnit unit) {
// Do not wait. return unit.convert(t, TimeUnit.MILLISECONDS);
} }
};
} @Override
public void blockUntil(Duration maxWait) {
// Do not wait.
}
};
}; };
} }

View File

@ -32,7 +32,7 @@ junit_tests(
exclude = TEST_BASE, exclude = TEST_BASE,
), ),
jvm_flags = [ jvm_flags = [
"-Xmx256m", "-Xmx512m",
"-Dfile.encoding=UTF-8", "-Dfile.encoding=UTF-8",
], ],
tags = ["lfs-server"], tags = ["lfs-server"],

View File

@ -137,7 +137,7 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<argLine>@{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx300m</argLine> <argLine>@{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx512m</argLine>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -53,7 +53,6 @@
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -123,13 +122,10 @@ public void testParallelUploads() throws Exception {
ExecutorService e = Executors.newFixedThreadPool(count); ExecutorService e = Executors.newFixedThreadPool(count);
try { try {
for (Path p : paths) { for (Path p : paths) {
e.submit(new Callable<Void>() { e.submit(() -> {
@Override barrier.await();
public Void call() throws Exception { putContent(p);
barrier.await(); return null;
putContent(p);
return null;
}
}); });
} }
} finally { } finally {

View File

@ -111,7 +111,7 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<argLine>@{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx300m</argLine> <argLine>@{argLine} -Djava.io.tmpdir=${project.build.directory} -Xmx512m</argLine>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -78,14 +78,7 @@ public class CleanFilter extends FilterCommand {
* The factory is responsible for creating instances of * The factory is responsible for creating instances of
* {@link org.eclipse.jgit.lfs.CleanFilter} * {@link org.eclipse.jgit.lfs.CleanFilter}
*/ */
public final static FilterCommandFactory FACTORY = new FilterCommandFactory() { public final static FilterCommandFactory FACTORY = CleanFilter::new;
@Override
public FilterCommand create(Repository db, InputStream in,
OutputStream out) throws IOException {
return new CleanFilter(db, in, out);
}
};
/** /**
* Registers this filter by calling * Registers this filter by calling

View File

@ -92,13 +92,7 @@ public class SmudgeFilter extends FilterCommand {
* The factory is responsible for creating instances of * The factory is responsible for creating instances of
* {@link org.eclipse.jgit.lfs.SmudgeFilter} * {@link org.eclipse.jgit.lfs.SmudgeFilter}
*/ */
public final static FilterCommandFactory FACTORY = new FilterCommandFactory() { public final static FilterCommandFactory FACTORY = SmudgeFilter::new;
@Override
public FilterCommand create(Repository db, InputStream in,
OutputStream out) throws IOException {
return new SmudgeFilter(db, in, out);
}
};
/** /**
* Register this filter in JGit * Register this filter in JGit

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde?><!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --><target name="jgit-4.10" sequenceNumber="1557148658"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.10" sequenceNumber="1558537043">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/>
@ -19,17 +22,17 @@
<unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/>
<repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/> <repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.ant.source" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant.source" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
@ -79,11 +82,11 @@
<unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/> <unit id="org.eclipse.osgi" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/2018-12/"/> <repository location="http://download.eclipse.org/releases/2018-12/"/>
</location> </location>
</locations> </locations>
</target> </target>

View File

@ -1,7 +1,7 @@
target "jgit-4.10" with source configurePhase target "jgit-4.10" with source configurePhase
include "projects/jetty-9.4.14.tpd" include "projects/jetty-9.4.14.tpd"
include "orbit/S20190501151401.tpd" include "orbit/S20190521195709.tpd"
location "http://download.eclipse.org/releases/2018-12/" { location "http://download.eclipse.org/releases/2018-12/" {
org.eclipse.osgi lazy org.eclipse.osgi lazy

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde?><!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --><target name="jgit-4.11" sequenceNumber="1557148673"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.11" sequenceNumber="1558539017">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/>
@ -19,17 +22,17 @@
<unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/>
<repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/> <repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.ant.source" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant.source" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
@ -79,11 +82,11 @@
<unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/> <unit id="org.eclipse.osgi" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/2019-03/"/> <repository location="http://download.eclipse.org/releases/2019-03/"/>
</location> </location>
</locations> </locations>
</target> </target>

View File

@ -1,7 +1,7 @@
target "jgit-4.11" with source configurePhase target "jgit-4.11" with source configurePhase
include "projects/jetty-9.4.14.tpd" include "projects/jetty-9.4.14.tpd"
include "orbit/S20190501151401.tpd" include "orbit/S20190521195709.tpd"
location "http://download.eclipse.org/releases/2019-03/" { location "http://download.eclipse.org/releases/2019-03/" {
org.eclipse.osgi lazy org.eclipse.osgi lazy

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde?><!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --><target name="jgit-4.12-staging" sequenceNumber="1557148680"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.12-staging" sequenceNumber="1558539043">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/>
@ -19,17 +22,17 @@
<unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/>
<repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/> <repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.ant.source" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant.source" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
@ -79,11 +82,11 @@
<unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/> <unit id="org.eclipse.osgi" version="0.0.0"/>
<repository location="http://download.eclipse.org/staging/2019-06/"/> <repository location="http://download.eclipse.org/staging/2019-06/"/>
</location> </location>
</locations> </locations>
</target> </target>

View File

@ -1,7 +1,7 @@
target "jgit-4.12-staging" with source configurePhase target "jgit-4.12-staging" with source configurePhase
include "projects/jetty-9.4.14.tpd" include "projects/jetty-9.4.14.tpd"
include "orbit/S20190501151401.tpd" include "orbit/S20190521195709.tpd"
location "http://download.eclipse.org/staging/2019-06/" { location "http://download.eclipse.org/staging/2019-06/" {
org.eclipse.osgi lazy org.eclipse.osgi lazy

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde?><!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --><target name="jgit-4.6" sequenceNumber="1557148684"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.6" sequenceNumber="1558539043">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/>
@ -19,17 +22,17 @@
<unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/>
<repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/> <repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.ant.source" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant.source" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
@ -79,11 +82,11 @@
<unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/> <unit id="org.eclipse.osgi" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/neon/"/> <repository location="http://download.eclipse.org/releases/neon/"/>
</location> </location>
</locations> </locations>
</target> </target>

View File

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

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde?><!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --><target name="jgit-4.7" sequenceNumber="1557148689"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.7" sequenceNumber="1558539038">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/>
@ -19,17 +22,17 @@
<unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/>
<repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/> <repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.ant.source" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant.source" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
@ -79,11 +82,11 @@
<unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/> <unit id="org.eclipse.osgi" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/oxygen/"/> <repository location="http://download.eclipse.org/releases/oxygen/"/>
</location> </location>
</locations> </locations>
</target> </target>

View File

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

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde?><!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --><target name="jgit-4.8" sequenceNumber="1557148692"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.8" sequenceNumber="1558539037">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/>
@ -19,17 +22,17 @@
<unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/>
<repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/> <repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.ant.source" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant.source" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
@ -79,11 +82,11 @@
<unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/> <unit id="org.eclipse.osgi" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/photon/"/> <repository location="http://download.eclipse.org/releases/photon/"/>
</location> </location>
</locations> </locations>
</target> </target>

View File

@ -1,7 +1,7 @@
target "jgit-4.8" with source configurePhase target "jgit-4.8" with source configurePhase
include "projects/jetty-9.4.14.tpd" include "projects/jetty-9.4.14.tpd"
include "orbit/S20190501151401.tpd" include "orbit/S20190521195709.tpd"
location "http://download.eclipse.org/releases/photon/" { location "http://download.eclipse.org/releases/photon/" {
org.eclipse.osgi lazy org.eclipse.osgi lazy

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde?><!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl --><target name="jgit-4.9" sequenceNumber="1557148695"> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.9" sequenceNumber="1558539042">
<locations> <locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.client.source" version="9.4.14.v20181114"/>
<unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.continuation" version="9.4.14.v20181114"/>
@ -19,17 +22,17 @@
<unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/> <unit id="org.eclipse.jetty.util.source" version="9.4.14.v20181114"/>
<repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/> <repository id="jetty-9.4.14" location="http://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.14.v20181114"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.apache.ant" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.ant.source" version="1.10.5.v20180808-0324"/> <unit id="org.apache.ant.source" version="1.10.6.v20190516-0412"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/> <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/> <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
<unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/> <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
<unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190213-1430"/> <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
<unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/> <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/> <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
@ -79,11 +82,11 @@
<unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
<unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/> <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository"/> <repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository"/>
</location> </location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit"> <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/> <unit id="org.eclipse.osgi" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/2018-09/"/> <repository location="http://download.eclipse.org/releases/2018-09/"/>
</location> </location>
</locations> </locations>
</target> </target>

View File

@ -1,7 +1,7 @@
target "jgit-4.9" with source configurePhase target "jgit-4.9" with source configurePhase
include "projects/jetty-9.4.14.tpd" include "projects/jetty-9.4.14.tpd"
include "orbit/S20190501151401.tpd" include "orbit/S20190521195709.tpd"
location "http://download.eclipse.org/releases/2018-09/" { location "http://download.eclipse.org/releases/2018-09/" {
org.eclipse.osgi lazy org.eclipse.osgi lazy

View File

@ -1,17 +1,17 @@
target "S20190501151401" with source configurePhase target "S20190521195709" with source configurePhase
// see http://download.eclipse.org/tools/orbit/downloads/ // see http://download.eclipse.org/tools/orbit/downloads/
location "http://download.eclipse.org/tools/orbit/downloads/drops/S20190501151401/repository" { location "http://download.eclipse.org/tools/orbit/downloads/drops/S20190521195709/repository" {
org.apache.ant [1.10.5.v20180808-0324,1.10.5.v20180808-0324] org.apache.ant [1.10.6.v20190516-0412,1.10.6.v20190516-0412]
org.apache.ant.source [1.10.5.v20180808-0324,1.10.5.v20180808-0324] org.apache.ant.source [1.10.6.v20190516-0412,1.10.6.v20190516-0412]
org.apache.commons.codec [1.10.0.v20180409-1845,1.10.0.v20180409-1845] org.apache.commons.codec [1.10.0.v20180409-1845,1.10.0.v20180409-1845]
org.apache.commons.codec.source [1.10.0.v20180409-1845,1.10.0.v20180409-1845] org.apache.commons.codec.source [1.10.0.v20180409-1845,1.10.0.v20180409-1845]
org.apache.commons.compress [1.18.0.v20181121-2221,1.18.0.v20181121-2221] org.apache.commons.compress [1.18.0.v20181121-2221,1.18.0.v20181121-2221]
org.apache.commons.compress.source [1.18.0.v20181121-2221,1.18.0.v20181121-2221] org.apache.commons.compress.source [1.18.0.v20181121-2221,1.18.0.v20181121-2221]
org.apache.commons.logging [1.2.0.v20180409-1502,1.2.0.v20180409-1502] org.apache.commons.logging [1.2.0.v20180409-1502,1.2.0.v20180409-1502]
org.apache.commons.logging.source [1.2.0.v20180409-1502,1.2.0.v20180409-1502] org.apache.commons.logging.source [1.2.0.v20180409-1502,1.2.0.v20180409-1502]
org.apache.httpcomponents.httpclient [4.5.6.v20190213-1430,4.5.6.v20190213-1430] org.apache.httpcomponents.httpclient [4.5.6.v20190503-0009,4.5.6.v20190503-0009]
org.apache.httpcomponents.httpclient.source [4.5.6.v20190213-1430,4.5.6.v20190213-1430] org.apache.httpcomponents.httpclient.source [4.5.6.v20190503-0009,4.5.6.v20190503-0009]
org.apache.httpcomponents.httpcore [4.4.10.v20190123-2214,4.4.10.v20190123-2214] org.apache.httpcomponents.httpcore [4.4.10.v20190123-2214,4.4.10.v20190123-2214]
org.apache.httpcomponents.httpcore.source [4.4.10.v20190123-2214,4.4.10.v20190123-2214] org.apache.httpcomponents.httpcore.source [4.4.10.v20190123-2214,4.4.10.v20190123-2214]
org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815] org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815]

View File

@ -7,7 +7,7 @@ junit_tests(
name = "pgm", name = "pgm",
srcs = glob(["tst/**/*.java"]), srcs = glob(["tst/**/*.java"]),
jvm_flags = [ jvm_flags = [
"-Xmx256m", "-Xmx512m",
"-Dfile.encoding=UTF-8", "-Dfile.encoding=UTF-8",
], ],
tags = ["pgm"], tags = ["pgm"],

View File

@ -109,7 +109,7 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<argLine>@{argLine} -Djava.io.tmpdir=${project.build.directory}</argLine> <argLine>@{argLine} -Xmx512m -Djava.io.tmpdir=${project.build.directory}</argLine>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -60,7 +60,6 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -703,15 +702,12 @@ private static String[] listZipEntries(byte[] zipData) throws IOException {
private static Future<Object> writeAsync(OutputStream stream, byte[] data) { private static Future<Object> writeAsync(OutputStream stream, byte[] data) {
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
return executor.submit(new Callable<Object>() { return executor.submit(() -> {
@Override try {
public Object call() throws IOException { stream.write(data);
try { return null;
stream.write(data); } finally {
return null; stream.close();
} finally {
stream.close();
}
} }
}); });
} }

View File

@ -52,7 +52,6 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -115,12 +114,8 @@ public static CommandRef[] common() {
private static CommandRef[] toSortedArray(Collection<CommandRef> c) { private static CommandRef[] toSortedArray(Collection<CommandRef> c) {
final CommandRef[] r = c.toArray(new CommandRef[0]); final CommandRef[] r = c.toArray(new CommandRef[0]);
Arrays.sort(r, new Comparator<CommandRef>() { Arrays.sort(r, (CommandRef o1, CommandRef o2) -> o1.getName()
@Override .compareTo(o2.getName()));
public int compare(CommandRef o1, CommandRef o2) {
return o1.getName().compareTo(o2.getName());
}
});
return r; return r;
} }

View File

@ -66,7 +66,6 @@
import org.eclipse.jgit.transport.ReceivePack; import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.resolver.FileResolver; import org.eclipse.jgit.transport.resolver.FileResolver;
import org.eclipse.jgit.transport.resolver.ReceivePackFactory; import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FS;
import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.Argument;
@ -188,22 +187,17 @@ private void startKetchLeader(org.eclipse.jgit.transport.Daemon daemon) {
final ReceivePackFactory<DaemonClient> factory; final ReceivePackFactory<DaemonClient> factory;
factory = daemon.getReceivePackFactory(); factory = daemon.getReceivePackFactory();
daemon.setReceivePackFactory(new ReceivePackFactory<DaemonClient>() { daemon.setReceivePackFactory((DaemonClient req, Repository repo) -> {
@Override ReceivePack rp = factory.create(req, repo);
public ReceivePack create(DaemonClient req, Repository repo) KetchLeader leader;
throws ServiceNotEnabledException, try {
ServiceNotAuthorizedException { leader = leaders.get(repo);
ReceivePack rp = factory.create(req, repo); } catch (URISyntaxException err) {
KetchLeader leader; throw new ServiceNotEnabledException(
try { KetchText.get().invalidFollowerUri, err);
leader = leaders.get(repo);
} catch (URISyntaxException err) {
throw new ServiceNotEnabledException(
KetchText.get().invalidFollowerUri, err);
}
rp.setPreReceiveHook(new KetchPreReceive(leader));
return rp;
} }
rp.setPreReceiveHook(new KetchPreReceive(leader));
return rp;
}); });
} }
} }

View File

@ -47,7 +47,6 @@
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
@ -87,11 +86,8 @@ public void windowClosing(WindowEvent e) {
final JPanel buttons = new JPanel(new FlowLayout()); final JPanel buttons = new JPanel(new FlowLayout());
final JButton repaint = new JButton(); final JButton repaint = new JButton();
repaint.setText(CLIText.get().repaint); repaint.setText(CLIText.get().repaint);
repaint.addActionListener(new ActionListener() { repaint.addActionListener((ActionEvent e) -> {
@Override graphPane.repaint();
public void actionPerformed(ActionEvent e) {
graphPane.repaint();
}
}); });
buttons.add(repaint); buttons.add(repaint);

View File

@ -46,7 +46,6 @@
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import java.io.IOException; import java.io.IOException;
import java.util.Comparator;
import java.util.TreeSet; import java.util.TreeSet;
import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Git;
@ -76,13 +75,8 @@ class LsRemote extends TextBuiltin {
protected void run() { protected void run() {
LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote) LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote)
.setTimeout(timeout).setHeads(heads).setTags(tags); .setTimeout(timeout).setHeads(heads).setTags(tags);
TreeSet<Ref> refs = new TreeSet<>(new Comparator<Ref>() { TreeSet<Ref> refs = new TreeSet<>(
(Ref r1, Ref r2) -> r1.getName().compareTo(r2.getName()));
@Override
public int compare(Ref r1, Ref r2) {
return r1.getName().compareTo(r2.getName());
}
});
try { try {
refs.addAll(command.call()); refs.addAll(command.call());
for (Ref r : refs) { for (Ref r : refs) {

View File

@ -52,7 +52,6 @@
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import org.eclipse.jgit.diff.DiffAlgorithm; import org.eclipse.jgit.diff.DiffAlgorithm;
@ -235,15 +234,12 @@ private void run(Repository repo) throws Exception {
} }
} }
Collections.sort(all, new Comparator<Test>() { Collections.sort(all, (Test a, Test b) -> {
@Override int result = Long.signum(a.runningTimeNanos - b.runningTimeNanos);
public int compare(Test a, Test b) { if (result == 0) {
int result = Long.signum(a.runningTimeNanos - b.runningTimeNanos); result = a.algorithm.name.compareTo(b.algorithm.name);
if (result == 0) {
result = a.algorithm.name.compareTo(b.algorithm.name);
}
return result;
} }
return result;
}); });
File directory = repo.getDirectory(); File directory = repo.getDirectory();

View File

@ -145,18 +145,13 @@ public void process() throws Exception {
*/ */
protected void askCredentials() { protected void askCredentials() {
clearPassword(); clearPassword();
PasswordAuthentication auth = AccessController PasswordAuthentication auth = AccessController.doPrivileged(
.doPrivileged(new PrivilegedAction<PasswordAuthentication>() { (PrivilegedAction<PasswordAuthentication>) () -> Authenticator
.requestPasswordAuthentication(proxy.getHostString(),
@Override proxy.getAddress(), proxy.getPort(),
public PasswordAuthentication run() { SshConstants.SSH_SCHEME,
return Authenticator.requestPasswordAuthentication(
proxy.getHostString(), proxy.getAddress(),
proxy.getPort(), SshConstants.SSH_SCHEME,
SshdText.get().proxyPasswordPrompt, "Basic", //$NON-NLS-1$ SshdText.get().proxyPasswordPrompt, "Basic", //$NON-NLS-1$
null, RequestorType.PROXY); null, RequestorType.PROXY));
}
});
if (auth == null) { if (auth == null) {
user = ""; //$NON-NLS-1$ user = ""; //$NON-NLS-1$
throw new CancellationException( throw new CancellationException(

View File

@ -19,6 +19,7 @@ HELPERS = glob(
"nls/MissingPropertyBundle.java", "nls/MissingPropertyBundle.java",
"nls/NoPropertiesBundle.java", "nls/NoPropertiesBundle.java",
"nls/NonTranslatedBundle.java", "nls/NonTranslatedBundle.java",
"revwalk/ReachabilityCheckerTestCase.java",
"revwalk/RevQueueTestCase.java", "revwalk/RevQueueTestCase.java",
"revwalk/RevWalkTestCase.java", "revwalk/RevWalkTestCase.java",
"transport/ObjectIdMatcher.java", "transport/ObjectIdMatcher.java",

View File

@ -190,7 +190,7 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<argLine>@{argLine} -Xmx1024m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine> <argLine>@{argLine} -Xmx768m -Dfile.encoding=UTF-8 -Djava.io.tmpdir=${project.build.directory}</argLine>
<includes> <includes>
<include>**/*Test.java</include> <include>**/*Test.java</include>
<include>**/*Tests.java</include> <include>**/*Tests.java</include>

View File

@ -346,14 +346,11 @@ private enum TestPullMode {
@Test @Test
/** global rebase config should be respected */ /** global rebase config should be respected */
public void testPullWithRebasePreserve1Config() throws Exception { public void testPullWithRebasePreserve1Config() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("pull", null, "rebase", "preserve");
StoredConfig config = dbTarget.getConfig(); config.save();
config.setString("pull", null, "rebase", "preserve"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.REBASE_PREASERVE); doTestPullWithRebase(setup, TestPullMode.REBASE_PREASERVE);
} }
@ -361,15 +358,12 @@ public PullResult call() throws Exception {
@Test @Test
/** the branch-local config should win over the global config */ /** the branch-local config should win over the global config */
public void testPullWithRebasePreserveConfig2() throws Exception { public void testPullWithRebasePreserveConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("pull", null, "rebase", "false");
StoredConfig config = dbTarget.getConfig(); config.setString("branch", "master", "rebase", "preserve");
config.setString("pull", null, "rebase", "false"); config.save();
config.setString("branch", "master", "rebase", "preserve"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.REBASE_PREASERVE); doTestPullWithRebase(setup, TestPullMode.REBASE_PREASERVE);
} }
@ -377,14 +371,11 @@ public PullResult call() throws Exception {
@Test @Test
/** the branch-local config should be respected */ /** the branch-local config should be respected */
public void testPullWithRebasePreserveConfig3() throws Exception { public void testPullWithRebasePreserveConfig3() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("branch", "master", "rebase", "preserve");
StoredConfig config = dbTarget.getConfig(); config.save();
config.setString("branch", "master", "rebase", "preserve"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.REBASE_PREASERVE); doTestPullWithRebase(setup, TestPullMode.REBASE_PREASERVE);
} }
@ -392,14 +383,11 @@ public PullResult call() throws Exception {
@Test @Test
/** global rebase config should be respected */ /** global rebase config should be respected */
public void testPullWithRebaseConfig1() throws Exception { public void testPullWithRebaseConfig1() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("pull", null, "rebase", "true");
StoredConfig config = dbTarget.getConfig(); config.save();
config.setString("pull", null, "rebase", "true"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.REBASE); doTestPullWithRebase(setup, TestPullMode.REBASE);
} }
@ -407,15 +395,12 @@ public PullResult call() throws Exception {
@Test @Test
/** the branch-local config should win over the global config */ /** the branch-local config should win over the global config */
public void testPullWithRebaseConfig2() throws Exception { public void testPullWithRebaseConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("pull", null, "rebase", "preserve");
StoredConfig config = dbTarget.getConfig(); config.setString("branch", "master", "rebase", "true");
config.setString("pull", null, "rebase", "preserve"); config.save();
config.setString("branch", "master", "rebase", "true"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.REBASE); doTestPullWithRebase(setup, TestPullMode.REBASE);
} }
@ -423,14 +408,11 @@ public PullResult call() throws Exception {
@Test @Test
/** the branch-local config should be respected */ /** the branch-local config should be respected */
public void testPullWithRebaseConfig3() throws Exception { public void testPullWithRebaseConfig3() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("branch", "master", "rebase", "true");
StoredConfig config = dbTarget.getConfig(); config.save();
config.setString("branch", "master", "rebase", "true"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.REBASE); doTestPullWithRebase(setup, TestPullMode.REBASE);
} }
@ -438,27 +420,19 @@ public PullResult call() throws Exception {
@Test @Test
/** without config it should merge */ /** without config it should merge */
public void testPullWithoutConfig() throws Exception { public void testPullWithoutConfig() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = target.pull()::call;
@Override
public PullResult call() throws Exception {
return target.pull().call();
}
};
doTestPullWithRebase(setup, TestPullMode.MERGE); doTestPullWithRebase(setup, TestPullMode.MERGE);
} }
@Test @Test
/** the branch local config should win over the global config */ /** the branch local config should win over the global config */
public void testPullWithMergeConfig() throws Exception { public void testPullWithMergeConfig() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("pull", null, "rebase", "true");
StoredConfig config = dbTarget.getConfig(); config.setString("branch", "master", "rebase", "false");
config.setString("pull", null, "rebase", "true"); config.save();
config.setString("branch", "master", "rebase", "false"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.MERGE); doTestPullWithRebase(setup, TestPullMode.MERGE);
} }
@ -466,14 +440,11 @@ public PullResult call() throws Exception {
@Test @Test
/** the branch local config should win over the global config */ /** the branch local config should win over the global config */
public void testPullWithMergeConfig2() throws Exception { public void testPullWithMergeConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() { Callable<PullResult> setup = () -> {
@Override StoredConfig config = dbTarget.getConfig();
public PullResult call() throws Exception { config.setString("pull", null, "rebase", "false");
StoredConfig config = dbTarget.getConfig(); config.save();
config.setString("pull", null, "rebase", "false"); return target.pull().call();
config.save();
return target.pull().call();
}
}; };
doTestPullWithRebase(setup, TestPullMode.MERGE); doTestPullWithRebase(setup, TestPullMode.MERGE);
} }

View File

@ -210,12 +210,8 @@ final class ReceivedEventMarkerException extends RuntimeException {
boolean receivedEvent = false; boolean receivedEvent = false;
DirCache dc = db.lockDirCache(); DirCache dc = db.lockDirCache();
IndexChangedListener listener = new IndexChangedListener() { IndexChangedListener listener = (IndexChangedEvent event) -> {
throw new ReceivedEventMarkerException();
@Override
public void onIndexChanged(IndexChangedEvent event) {
throw new ReceivedEventMarkerException();
}
}; };
ListenerList l = db.getListenerList(); ListenerList l = db.getListenerList();
@ -238,12 +234,8 @@ public void onIndexChanged(IndexChangedEvent event) {
// do the same again, as this doesn't change index compared to first // do the same again, as this doesn't change index compared to first
// round we should get no event this time // round we should get no event this time
dc = db.lockDirCache(); dc = db.lockDirCache();
listener = new IndexChangedListener() { listener = (IndexChangedEvent event) -> {
throw new ReceivedEventMarkerException();
@Override
public void onIndexChanged(IndexChangedEvent event) {
throw new ReceivedEventMarkerException();
}
}; };
l = db.getListenerList(); l = db.getListenerList();

View File

@ -54,12 +54,9 @@ public class ConfigChangeEventTest extends RepositoryTestCase {
@Test @Test
public void testFileRepository_ChangeEventsOnlyOnSave() throws Exception { public void testFileRepository_ChangeEventsOnlyOnSave() throws Exception {
final ConfigChangedEvent[] events = new ConfigChangedEvent[1]; final ConfigChangedEvent[] events = new ConfigChangedEvent[1];
db.getListenerList().addConfigChangedListener( db.getListenerList()
new ConfigChangedListener() { .addConfigChangedListener((ConfigChangedEvent event) -> {
@Override events[0] = event;
public void onConfigChanged(ConfigChangedEvent event) {
events[0] = event;
}
}); });
FileBasedConfig config = db.getConfig(); FileBasedConfig config = db.getConfig();
assertNull(events[0]); assertNull(events[0]);

View File

@ -239,20 +239,15 @@ public void testInterruptGc() throws Exception {
SampleDataRepositoryTestCase.copyCGitTestPacks(repo); SampleDataRepositoryTestCase.copyCGitTestPacks(repo);
ExecutorService executor = Executors.newSingleThreadExecutor(); ExecutorService executor = Executors.newSingleThreadExecutor();
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
Future<Collection<PackFile>> result = executor Future<Collection<PackFile>> result = executor.submit(() -> {
.submit(new Callable<Collection<PackFile>>() { long start = System.currentTimeMillis();
System.out.println("starting gc");
@Override latch.countDown();
public Collection<PackFile> call() throws Exception { Collection<PackFile> r = gc.gc();
long start = System.currentTimeMillis(); System.out.println(
System.out.println("starting gc"); "gc took " + (System.currentTimeMillis() - start) + " ms");
latch.countDown(); return r;
Collection<PackFile> r = gc.gc(); });
System.out.println("gc took "
+ (System.currentTimeMillis() - start) + " ms");
return r;
}
});
try { try {
latch.await(); latch.await();
Thread.sleep(5); Thread.sleep(5);

View File

@ -155,38 +155,32 @@ public void whileRefUpdatedRefUpdateSucceeds()
final CyclicBarrier packRefsDone = new CyclicBarrier(2); final CyclicBarrier packRefsDone = new CyclicBarrier(2);
ExecutorService pool = Executors.newFixedThreadPool(2); ExecutorService pool = Executors.newFixedThreadPool(2);
try { try {
Future<Result> result = pool.submit(new Callable<Result>() { Future<Result> result = pool.submit(() -> {
RefUpdate update = new RefDirectoryUpdate(
@Override (RefDirectory) repo.getRefDatabase(),
public Result call() throws Exception { repo.exactRef("refs/tags/t")) {
RefUpdate update = new RefDirectoryUpdate( @Override
(RefDirectory) repo.getRefDatabase(), public boolean isForceUpdate() {
repo.exactRef("refs/tags/t")) { try {
@Override refUpdateLockedRef.await();
public boolean isForceUpdate() { packRefsDone.await();
try { } catch (InterruptedException
refUpdateLockedRef.await(); | BrokenBarrierException e) {
packRefsDone.await(); Thread.currentThread().interrupt();
} catch (InterruptedException | BrokenBarrierException e) {
Thread.currentThread().interrupt();
}
return super.isForceUpdate();
} }
}; return super.isForceUpdate();
update.setForceUpdate(true); }
update.setNewObjectId(b); };
return update.update(); update.setForceUpdate(true);
} update.setNewObjectId(b);
return update.update();
}); });
pool.submit(new Callable<Void>() { pool.submit(() -> {
@Override refUpdateLockedRef.await();
public Void call() throws Exception { gc.packRefs();
refUpdateLockedRef.await(); packRefsDone.await();
gc.packRefs(); return null;
packRefsDone.await();
return null;
}
}); });
assertSame(result.get(), Result.FORCED); assertSame(result.get(), Result.FORCED);

View File

@ -47,7 +47,6 @@
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.File; import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.text.MessageFormat; import java.text.MessageFormat;
@ -167,12 +166,8 @@ public void testScanningForPackfiles() throws Exception {
// Bug. To show the bug we sleep for more than 2500ms // Bug. To show the bug we sleep for more than 2500ms
Thread.sleep(2600); Thread.sleep(2600);
File[] ret = packsFolder.listFiles(new FilenameFilter() { File[] ret = packsFolder.listFiles(
@Override (File dir, String name) -> name.endsWith(".pack"));
public boolean accept(File dir, String name) {
return name.endsWith(".pack");
}
});
assertTrue(ret != null && ret.length == 1); assertTrue(ret != null && ret.length == 1);
Assume.assumeTrue(tmpFile.lastModified() == ret[0].lastModified()); Assume.assumeTrue(tmpFile.lastModified() == ret[0].lastModified());
@ -220,12 +215,8 @@ public void testShallowFileCorrupt()
private Collection<Callable<ObjectId>> blobInsertersForTheSameFanOutDir( private Collection<Callable<ObjectId>> blobInsertersForTheSameFanOutDir(
final ObjectDirectory dir) { final ObjectDirectory dir) {
Callable<ObjectId> callable = new Callable<ObjectId>() { Callable<ObjectId> callable = () -> dir.newInserter()
@Override .insert(Constants.OBJ_BLOB, new byte[0]);
public ObjectId call() throws Exception {
return dir.newInserter().insert(Constants.OBJ_BLOB, new byte[0]);
}
};
return Collections.nCopies(4, callable); return Collections.nCopies(4, callable);
} }

View File

@ -60,7 +60,6 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -881,12 +880,8 @@ private void verifyObjectsOrder(ObjectId objectsOrder[]) {
for (MutableEntry me : pack) { for (MutableEntry me : pack) {
entries.add(me.cloneEntry()); entries.add(me.cloneEntry());
} }
Collections.sort(entries, new Comparator<PackIndex.MutableEntry>() { Collections.sort(entries, (MutableEntry o1, MutableEntry o2) -> Long
@Override .signum(o1.getOffset() - o2.getOffset()));
public int compare(MutableEntry o1, MutableEntry o2) {
return Long.signum(o1.getOffset() - o2.getOffset());
}
});
int i = 0; int i = 0;
for (MutableEntry me : entries) { for (MutableEntry me : entries) {

View File

@ -70,7 +70,6 @@
import org.eclipse.jgit.errors.LockFailedException; import org.eclipse.jgit.errors.LockFailedException;
import org.eclipse.jgit.events.ListenerHandle; import org.eclipse.jgit.events.ListenerHandle;
import org.eclipse.jgit.events.RefsChangedEvent; import org.eclipse.jgit.events.RefsChangedEvent;
import org.eclipse.jgit.events.RefsChangedListener;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.junit.TestRepository; import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.AnyObjectId;
@ -570,12 +569,8 @@ public void testGetRefs_LooseSorting_Bug_348834() throws IOException {
final int[] count = new int[1]; final int[] count = new int[1];
ListenerHandle listener = Repository.getGlobalListenerList() ListenerHandle listener = Repository.getGlobalListenerList()
.addRefsChangedListener(new RefsChangedListener() { .addRefsChangedListener((RefsChangedEvent event) -> {
count[0]++;
@Override
public void onRefsChanged(RefsChangedEvent event) {
count[0]++;
}
}); });
refs = refdir.getRefs(RefDatabase.ALL); refs = refdir.getRefs(RefDatabase.ALL);
@ -1316,19 +1311,15 @@ public void testRefsChangedStackOverflow() throws Exception {
final AtomicReference<StackOverflowError> error = new AtomicReference<>(); final AtomicReference<StackOverflowError> error = new AtomicReference<>();
final AtomicReference<IOException> exception = new AtomicReference<>(); final AtomicReference<IOException> exception = new AtomicReference<>();
final AtomicInteger changeCount = new AtomicInteger(); final AtomicInteger changeCount = new AtomicInteger();
newRepo.getListenerList().addRefsChangedListener( newRepo.getListenerList()
new RefsChangedListener() { .addRefsChangedListener((RefsChangedEvent event) -> {
try {
@Override refDb.getRefsByPrefix("ref");
public void onRefsChanged(RefsChangedEvent event) { changeCount.incrementAndGet();
try { } catch (StackOverflowError soe) {
refDb.getRefsByPrefix("ref"); error.set(soe);
changeCount.incrementAndGet(); } catch (IOException ioe) {
} catch (StackOverflowError soe) { exception.set(ioe);
error.set(soe);
} catch (IOException ioe) {
exception.set(ioe);
}
} }
}); });
refDb.getRefsByPrefix("ref"); refDb.getRefsByPrefix("ref");

View File

@ -633,35 +633,23 @@ private static ReceiveCommand command(AnyObjectId a, AnyObjectId b,
private void symref(String name, String dst) private void symref(String name, String dst)
throws IOException { throws IOException {
commit(new Function() { commit((ObjectReader reader, RefTree tree) -> {
@Override Ref old = tree.exactRef(reader, name);
public boolean apply(ObjectReader reader, RefTree tree) Command n = new Command(old, new SymbolicRef(name,
throws IOException { new ObjectIdRef.Unpeeled(Ref.Storage.NEW, dst, null)));
Ref old = tree.exactRef(reader, name); return tree.apply(Collections.singleton(n));
Command n = new Command(
old,
new SymbolicRef(
name,
new ObjectIdRef.Unpeeled(Ref.Storage.NEW, dst, null)));
return tree.apply(Collections.singleton(n));
}
}); });
} }
private void update(String name, ObjectId id) private void update(String name, ObjectId id)
throws IOException { throws IOException {
commit(new Function() { commit((ObjectReader reader, RefTree tree) -> {
@Override Ref old = tree.exactRef(reader, name);
public boolean apply(ObjectReader reader, RefTree tree) Command n;
throws IOException { try (RevWalk rw = new RevWalk(repo)) {
Ref old = tree.exactRef(reader, name); n = new Command(old, Command.toRef(rw, id, null, name, true));
Command n;
try (RevWalk rw = new RevWalk(repo)) {
n = new Command(old,
Command.toRef(rw, id, null, name, true));
}
return tree.apply(Collections.singleton(n));
} }
return tree.apply(Collections.singleton(n));
}); });
} }

View File

@ -1775,16 +1775,13 @@ private void assertSkipListRejects(String msg, int type, byte[] data) {
} }
private static ObjectIdSet set(ObjectId... ids) { private static ObjectIdSet set(ObjectId... ids) {
return new ObjectIdSet() { return (AnyObjectId objectId) -> {
@Override for (ObjectId id : ids) {
public boolean contains(AnyObjectId objectId) { if (id.equals(objectId)) {
for (ObjectId id : ids) { return true;
if (id.equals(objectId)) {
return true;
}
} }
return false;
} }
return false;
}; };
} }

View File

@ -61,29 +61,26 @@ public void testFailsMethodsOnBackgroundThread()
final MockProgressMonitor mock = new MockProgressMonitor(); final MockProgressMonitor mock = new MockProgressMonitor();
final ThreadSafeProgressMonitor pm = new ThreadSafeProgressMonitor(mock); final ThreadSafeProgressMonitor pm = new ThreadSafeProgressMonitor(mock);
runOnThread(new Runnable() { runOnThread(() -> {
@Override try {
public void run() { pm.start(1);
try { fail("start did not fail on background thread");
pm.start(1); } catch (IllegalStateException notMainThread) {
fail("start did not fail on background thread"); // Expected result
} catch (IllegalStateException notMainThread) { }
// Expected result
}
try { try {
pm.beginTask("title", 1); pm.beginTask("title", 1);
fail("beginTask did not fail on background thread"); fail("beginTask did not fail on background thread");
} catch (IllegalStateException notMainThread) { } catch (IllegalStateException notMainThread) {
// Expected result // Expected result
} }
try { try {
pm.endTask(); pm.endTask();
fail("endTask did not fail on background thread"); fail("endTask did not fail on background thread");
} catch (IllegalStateException notMainThread) { } catch (IllegalStateException notMainThread) {
// Expected result // Expected result
}
} }
}); });

View File

@ -0,0 +1,139 @@
package org.eclipse.jgit.revwalk;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.internal.storage.file.GC;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.junit.Before;
import org.junit.Test;
public class BitmapCalculatorTest extends LocalDiskRepositoryTestCase {
TestRepository<FileRepository> repo;
/** {@inheritDoc} */
@Override
@Before
public void setUp() throws Exception {
super.setUp();
FileRepository db = createWorkRepository();
repo = new TestRepository<>(db);
}
@Test
public void addOnlyCommits() throws Exception {
RevBlob abBlob = repo.blob("a_b_content");
RevCommit root = repo.commit().add("a/b", abBlob).create();
repo.update("refs/heads/master", root);
// GC creates bitmap index with ALL objects
GC gc = new GC(repo.getRepository());
gc.setAuto(false);
gc.gc();
// These objects are not in the bitmap index.
RevBlob acBlob = repo.blob("a_c_content");
RevCommit head = repo.commit().parent(root).add("a/c", acBlob).create();
repo.update("refs/heads/master", head);
BitmapCalculator bitmapWalker = new BitmapCalculator(repo.getRevWalk());
BitmapBuilder bitmap = bitmapWalker
.getBitmap(head, NullProgressMonitor.INSTANCE);
assertTrue(bitmap.contains(root.getId()));
assertTrue(bitmap.contains(root.getTree().getId()));
assertTrue(bitmap.contains(abBlob.getId()));
// BitmapCalculator added only the commit, no other objects.
assertTrue(bitmap.contains(head.getId()));
assertFalse(bitmap.contains(head.getTree().getId()));
assertFalse(bitmap.contains(acBlob.getId()));
}
@Test
public void walkUntilBitmap() throws Exception {
RevCommit root = repo.commit().create();
repo.update("refs/heads/master", root);
// GC creates bitmap index with ALL objects
GC gc = new GC(repo.getRepository());
gc.setAuto(false);
gc.gc();
// These objects are not in the bitmap index.
RevCommit commit1 = repo.commit(root);
RevCommit commit2 = repo.commit(commit1);
repo.update("refs/heads/master", commit2);
CounterProgressMonitor monitor = new CounterProgressMonitor();
BitmapCalculator bitmapWalker = new BitmapCalculator(repo.getRevWalk());
BitmapBuilder bitmap = bitmapWalker.getBitmap(commit2, monitor);
assertTrue(bitmap.contains(root));
assertTrue(bitmap.contains(commit1));
assertTrue(bitmap.contains(commit2));
assertEquals(2, monitor.getUpdates());
}
@Test
public void noNeedToWalk() throws Exception {
RevCommit root = repo.commit().create();
RevCommit commit1 = repo.commit(root);
RevCommit commit2 = repo.commit(commit1);
repo.update("refs/heads/master", commit2);
// GC creates bitmap index with ALL objects
GC gc = new GC(repo.getRepository());
gc.setAuto(false);
gc.gc();
CounterProgressMonitor monitor = new CounterProgressMonitor();
BitmapCalculator bitmapWalker = new BitmapCalculator(repo.getRevWalk());
BitmapBuilder bitmap = bitmapWalker.getBitmap(commit2, monitor);
assertTrue(bitmap.contains(root));
assertTrue(bitmap.contains(commit1));
assertTrue(bitmap.contains(commit2));
assertEquals(0, monitor.getUpdates());
}
private static class CounterProgressMonitor implements ProgressMonitor {
private int counter;
@Override
public void start(int totalTasks) {
// Nothing to do in tests
}
@Override
public void beginTask(String title, int totalWork) {
// Nothing to to in tests
}
@Override
public void update(int completed) {
counter += 1;
}
@Override
public void endTask() {
// Nothing to do in tests
}
@Override
public boolean isCancelled() {
return false;
}
int getUpdates() {
return counter;
}
}
}

View File

@ -0,0 +1,69 @@
/*
* Copyright (C) 2019, 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.revwalk;
import static org.junit.Assert.assertNotNull;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.internal.storage.file.GC;
import org.eclipse.jgit.junit.TestRepository;
public class BitmappedReachabilityCheckerTest
extends ReachabilityCheckerTestCase {
@Override
protected ReachabilityChecker getChecker(
TestRepository<FileRepository> repository) throws Exception {
// GC generates the bitmaps
GC gc = new GC(repo.getRepository());
gc.setAuto(false);
gc.gc();
// This is null when the test didn't create any branch
assertNotNull("Probably the test didn't define any ref",
repo.getRevWalk().getObjectReader().getBitmapIndex());
return new BitmappedReachabilityChecker(repository.getRevWalk());
}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2019, 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.revwalk;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.TestRepository;
public class PedestrianReachabilityCheckerTest
extends ReachabilityCheckerTestCase {
@Override
protected ReachabilityChecker getChecker(
TestRepository<FileRepository> repository) {
return new PedestrianReachabilityChecker(true, repository.getRevWalk());
}
}

View File

@ -0,0 +1,168 @@
/*
* Copyright (C) 2019, 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.revwalk;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.Optional;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase;
import org.eclipse.jgit.junit.TestRepository;
import org.junit.Before;
import org.junit.Test;
public abstract class ReachabilityCheckerTestCase
extends LocalDiskRepositoryTestCase {
protected abstract ReachabilityChecker getChecker(
TestRepository<FileRepository> repository) throws Exception;
TestRepository<FileRepository> repo;
/** {@inheritDoc} */
@Override
@Before
public void setUp() throws Exception {
super.setUp();
FileRepository db = createWorkRepository();
repo = new TestRepository<>(db);
}
@Test
public void reachable() throws Exception {
RevCommit a = repo.commit().create();
RevCommit b1 = repo.commit(a);
RevCommit b2 = repo.commit(b1);
RevCommit c1 = repo.commit(a);
RevCommit c2 = repo.commit(c1);
repo.update("refs/heads/checker", b2);
ReachabilityChecker checker = getChecker(repo);
assertReachable("reachable from one tip",
checker.areAllReachable(Arrays.asList(a), Arrays.asList(c2)));
assertReachable("reachable from another tip",
checker.areAllReachable(Arrays.asList(a), Arrays.asList(b2)));
assertReachable("reachable from itself",
checker.areAllReachable(Arrays.asList(a), Arrays.asList(b2)));
}
@Test
public void reachable_merge() throws Exception {
RevCommit a = repo.commit().create();
RevCommit b1 = repo.commit(a);
RevCommit b2 = repo.commit(b1);
RevCommit c1 = repo.commit(a);
RevCommit c2 = repo.commit(c1);
RevCommit merge = repo.commit(c2, b2);
repo.update("refs/heads/checker", merge);
ReachabilityChecker checker = getChecker(repo);
assertReachable("reachable through one branch",
checker.areAllReachable(Arrays.asList(b1),
Arrays.asList(merge)));
assertReachable("reachable through another branch",
checker.areAllReachable(Arrays.asList(c1),
Arrays.asList(merge)));
assertReachable("reachable, before the branching",
checker.areAllReachable(Arrays.asList(a),
Arrays.asList(merge)));
}
@Test
public void unreachable_isLaterCommit() throws Exception {
RevCommit a = repo.commit().create();
RevCommit b1 = repo.commit(a);
RevCommit b2 = repo.commit(b1);
repo.update("refs/heads/checker", b2);
ReachabilityChecker checker = getChecker(repo);
assertUnreachable("unreachable from the future",
checker.areAllReachable(Arrays.asList(b2), Arrays.asList(b1)));
}
@Test
public void unreachable_differentBranch() throws Exception {
RevCommit a = repo.commit().create();
RevCommit b1 = repo.commit(a);
RevCommit b2 = repo.commit(b1);
RevCommit c1 = repo.commit(a);
repo.update("refs/heads/checker", b2);
ReachabilityChecker checker = getChecker(repo);
assertUnreachable("unreachable from different branch",
checker.areAllReachable(Arrays.asList(c1), Arrays.asList(b2)));
}
@Test
public void reachable_longChain() throws Exception {
RevCommit root = repo.commit().create();
RevCommit head = root;
for (int i = 0; i < 10000; i++) {
head = repo.commit(head);
}
repo.update("refs/heads/master", head);
ReachabilityChecker checker = getChecker(repo);
assertReachable("reachable with long chain in the middle", checker
.areAllReachable(Arrays.asList(root), Arrays.asList(head)));
}
private static void assertReachable(String msg,
Optional<RevCommit> result) {
assertFalse(msg, result.isPresent());
}
private static void assertUnreachable(String msg,
Optional<RevCommit> result) {
assertTrue(msg, result.isPresent());
}
}

View File

@ -67,9 +67,6 @@
import org.eclipse.jgit.lib.ObjectInserter; import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -91,27 +88,16 @@ public void setUp() throws Exception {
server = newRepo("server"); server = newRepo("server");
client = newRepo("client"); client = newRepo("client");
processedRefs = new ArrayList<>(); processedRefs = new ArrayList<>();
testProtocol = new TestProtocol<>( testProtocol = new TestProtocol<>(null, (Object req, Repository db) -> {
null, ReceivePack rp = new ReceivePack(db);
new ReceivePackFactory<Object>() { rp.setPreReceiveHook((ReceivePack receivePack,
@Override Collection<ReceiveCommand> cmds) -> {
public ReceivePack create(Object req, Repository db) for (ReceiveCommand cmd : cmds) {
throws ServiceNotEnabledException, processedRefs.add(cmd.getRefName());
ServiceNotAuthorizedException { }
ReceivePack rp = new ReceivePack(db); });
rp.setPreReceiveHook( return rp;
new PreReceiveHook() { });
@Override
public void onPreReceive(ReceivePack receivePack,
Collection<ReceiveCommand> cmds) {
for (ReceiveCommand cmd : cmds) {
processedRefs.add(cmd.getRefName());
}
}
});
return rp;
}
});
uri = testProtocol.register(ctx, server); uri = testProtocol.register(ctx, server);
try (ObjectInserter ins = server.newObjectInserter()) { try (ObjectInserter ins = server.newObjectInserter()) {

View File

@ -69,9 +69,6 @@
import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -95,16 +92,11 @@ public void setUp() throws Exception {
client = newRepo("client"); client = newRepo("client");
testProtocol = new TestProtocol<>(null, testProtocol = new TestProtocol<>(null,
new ReceivePackFactory<Object>() { (Object req, Repository git) -> {
@Override receivePack = new ReceivePack(git);
public ReceivePack create(Object req, Repository git) receivePack.setAllowPushOptions(true);
throws ServiceNotEnabledException, receivePack.setAtomic(true);
ServiceNotAuthorizedException { return receivePack;
receivePack = new ReceivePack(git);
receivePack.setAllowPushOptions(true);
receivePack.setAtomic(true);
return receivePack;
}
}); });
uri = testProtocol.register(ctx, server); uri = testProtocol.register(ctx, server);

View File

@ -92,11 +92,8 @@ private static class DefaultUpload implements UploadPackFactory<User> {
@Override @Override
public UploadPack create(User req, Repository db) { public UploadPack create(User req, Repository db) {
UploadPack up = new UploadPack(db); UploadPack up = new UploadPack(db);
up.setPostUploadHook(new PostUploadHook() { up.setPostUploadHook((PackStatistics stats) -> {
@Override havesCount = stats.getHaves();
public void onPostUpload(PackStatistics stats) {
havesCount = stats.getHaves();
}
}); });
return up; return up;
} }
@ -217,16 +214,12 @@ public void testUploadPackFactory() throws Exception {
ObjectId master = remote.branch("master").commit().create(); ObjectId master = remote.branch("master").commit().create();
final AtomicInteger rejected = new AtomicInteger(); final AtomicInteger rejected = new AtomicInteger();
TestProtocol<User> proto = registerProto(new UploadPackFactory<User>() { TestProtocol<User> proto = registerProto((User req, Repository db) -> {
@Override if (!"user2".equals(req.name)) {
public UploadPack create(User req, Repository db) rejected.incrementAndGet();
throws ServiceNotAuthorizedException { throw new ServiceNotAuthorizedException();
if (!"user2".equals(req.name)) {
rejected.incrementAndGet();
throw new ServiceNotAuthorizedException();
}
return new UploadPack(db);
} }
return new UploadPack(db);
}, new DefaultReceive()); }, new DefaultReceive());
// Same repository, different users. // Same repository, different users.
@ -262,16 +255,12 @@ public void testReceivePackFactory() throws Exception {
final AtomicInteger rejected = new AtomicInteger(); final AtomicInteger rejected = new AtomicInteger();
TestProtocol<User> proto = registerProto(new DefaultUpload(), TestProtocol<User> proto = registerProto(new DefaultUpload(),
new ReceivePackFactory<User>() { (User req, Repository db) -> {
@Override if (!"user2".equals(req.name)) {
public ReceivePack create(User req, Repository db) rejected.incrementAndGet();
throws ServiceNotAuthorizedException { throw new ServiceNotAuthorizedException();
if (!"user2".equals(req.name)) {
rejected.incrementAndGet();
throw new ServiceNotAuthorizedException();
}
return new ReceivePack(db);
} }
return new ReceivePack(db);
}); });
// Same repository, different users. // Same repository, different users.

View File

@ -47,9 +47,6 @@
import org.eclipse.jgit.revwalk.RevTree; import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.storage.pack.PackStatistics; import org.eclipse.jgit.storage.pack.PackStatistics;
import org.eclipse.jgit.transport.UploadPack.RequestPolicy; import org.eclipse.jgit.transport.UploadPack.RequestPolicy;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.transport.resolver.UploadPackFactory;
import org.eclipse.jgit.util.io.NullOutputStream; import org.eclipse.jgit.util.io.NullOutputStream;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.After; import org.junit.After;
@ -102,17 +99,11 @@ private void generateBitmaps(InMemoryRepository repo) throws Exception {
} }
private static TestProtocol<Object> generateReachableCommitUploadPackProtocol() { private static TestProtocol<Object> generateReachableCommitUploadPackProtocol() {
return new TestProtocol<>( return new TestProtocol<>((Object req, Repository db) -> {
new UploadPackFactory<Object>() { UploadPack up = new UploadPack(db);
@Override up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT);
public UploadPack create(Object req, Repository db) return up;
throws ServiceNotEnabledException, }, null);
ServiceNotAuthorizedException {
UploadPack up = new UploadPack(db);
up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT);
return up;
}
}, null);
} }
@Test @Test
@ -122,20 +113,14 @@ public void testFetchParentOfShallowCommit() throws Exception {
RevCommit tip = remote.commit().message("2").parent(commit1).create(); RevCommit tip = remote.commit().message("2").parent(commit1).create();
remote.update("master", tip); remote.update("master", tip);
testProtocol = new TestProtocol<>( testProtocol = new TestProtocol<>((Object req, Repository db) -> {
new UploadPackFactory<Object>() { UploadPack up = new UploadPack(db);
@Override up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT);
public UploadPack create(Object req, Repository db) // assume client has a shallow commit
throws ServiceNotEnabledException, up.getRevWalk()
ServiceNotAuthorizedException { .assumeShallow(Collections.singleton(commit1.getId()));
UploadPack up = new UploadPack(db); return up;
up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT); }, null);
// assume client has a shallow commit
up.getRevWalk().assumeShallow(
Collections.singleton(commit1.getId()));
return up;
}
}, null);
uri = testProtocol.register(ctx, server); uri = testProtocol.register(ctx, server);
assertFalse(client.getObjectDatabase().has(commit0.toObjectId())); assertFalse(client.getObjectDatabase().has(commit0.toObjectId()));
@ -222,14 +207,9 @@ public void testFetchWithBlobNoneFilter() throws Exception {
server2.getConfig().setBoolean("uploadpack", null, "allowfilter", server2.getConfig().setBoolean("uploadpack", null, "allowfilter",
true); true);
testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { testProtocol = new TestProtocol<>((Object req, Repository db) -> {
@Override UploadPack up = new UploadPack(db);
public UploadPack create(Object req, Repository db) return up;
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack(db);
return up;
}
}, null); }, null);
uri = testProtocol.register(ctx, server2); uri = testProtocol.register(ctx, server2);
@ -260,14 +240,9 @@ public void testFetchExplicitBlobWithFilter() throws Exception {
server2.getConfig().setBoolean("uploadpack", null, "allowfilter", server2.getConfig().setBoolean("uploadpack", null, "allowfilter",
true); true);
testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { testProtocol = new TestProtocol<>((Object req, Repository db) -> {
@Override UploadPack up = new UploadPack(db);
public UploadPack create(Object req, Repository db) return up;
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack(db);
return up;
}
}, null); }, null);
uri = testProtocol.register(ctx, server2); uri = testProtocol.register(ctx, server2);
@ -297,14 +272,9 @@ public void testFetchWithBlobLimitFilter() throws Exception {
server2.getConfig().setBoolean("uploadpack", null, "allowfilter", server2.getConfig().setBoolean("uploadpack", null, "allowfilter",
true); true);
testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { testProtocol = new TestProtocol<>((Object req, Repository db) -> {
@Override UploadPack up = new UploadPack(db);
public UploadPack create(Object req, Repository db) return up;
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack(db);
return up;
}
}, null); }, null);
uri = testProtocol.register(ctx, server2); uri = testProtocol.register(ctx, server2);
@ -340,14 +310,9 @@ public void testFetchExplicitBlobWithFilterAndBitmaps() throws Exception {
new DfsGarbageCollector(server2).pack(null); new DfsGarbageCollector(server2).pack(null);
server2.scanForRepoChanges(); server2.scanForRepoChanges();
testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { testProtocol = new TestProtocol<>((Object req, Repository db) -> {
@Override UploadPack up = new UploadPack(db);
public UploadPack create(Object req, Repository db) return up;
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack(db);
return up;
}
}, null); }, null);
uri = testProtocol.register(ctx, server2); uri = testProtocol.register(ctx, server2);
@ -380,14 +345,9 @@ public void testFetchWithBlobLimitFilterAndBitmaps() throws Exception {
new DfsGarbageCollector(server2).pack(null); new DfsGarbageCollector(server2).pack(null);
server2.scanForRepoChanges(); server2.scanForRepoChanges();
testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { testProtocol = new TestProtocol<>((Object req, Repository db) -> {
@Override UploadPack up = new UploadPack(db);
public UploadPack create(Object req, Repository db) return up;
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack(db);
return up;
}
}, null); }, null);
uri = testProtocol.register(ctx, server2); uri = testProtocol.register(ctx, server2);
@ -416,14 +376,9 @@ public void testFetchWithNonSupportingServer() throws Exception {
server2.getConfig().setBoolean("uploadpack", null, "allowfilter", server2.getConfig().setBoolean("uploadpack", null, "allowfilter",
false); false);
testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { testProtocol = new TestProtocol<>((Object req, Repository db) -> {
@Override UploadPack up = new UploadPack(db);
public UploadPack create(Object req, Repository db) return up;
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack(db);
return up;
}
}, null); }, null);
uri = testProtocol.register(ctx, server2); uri = testProtocol.register(ctx, server2);

View File

@ -582,26 +582,23 @@ public void idOffset() throws Exception {
} }
} }
private final FileTreeIterator.FileModeStrategy NO_GITLINKS_STRATEGY = private final FileTreeIterator.FileModeStrategy NO_GITLINKS_STRATEGY = (
new FileTreeIterator.FileModeStrategy() { File f, FS.Attributes attributes) -> {
@Override if (attributes.isSymbolicLink()) {
public FileMode getMode(File f, FS.Attributes attributes) { return FileMode.SYMLINK;
if (attributes.isSymbolicLink()) { } else if (attributes.isDirectory()) {
return FileMode.SYMLINK; // NOTE: in the production DefaultFileModeStrategy, there is
} else if (attributes.isDirectory()) { // a check here for a subdirectory called '.git', and if it
// NOTE: in the production DefaultFileModeStrategy, there is // exists, we create a GITLINK instead of recursing into the
// a check here for a subdirectory called '.git', and if it // tree. In this custom strategy, we ignore nested git dirs
// exists, we create a GITLINK instead of recursing into the // and treat all directories the same.
// tree. In this custom strategy, we ignore nested git dirs return FileMode.TREE;
// and treat all directories the same. } else if (attributes.isExecutable()) {
return FileMode.TREE; return FileMode.EXECUTABLE_FILE;
} else if (attributes.isExecutable()) { } else {
return FileMode.EXECUTABLE_FILE; return FileMode.REGULAR_FILE;
} else { }
return FileMode.REGULAR_FILE; };
}
}
};
private Repository createNestedRepo() throws IOException { private Repository createNestedRepo() throws IOException {
File gitdir = createUniqueTestGitDir(false); File gitdir = createUniqueTestGitDir(false);

View File

@ -330,6 +330,7 @@ gpgNoKeyring=neither pubring.kbx nor secring.gpg files found
gpgNoKeyInLegacySecring=no matching secret key found in legacy secring.gpg for key or user id: {0} gpgNoKeyInLegacySecring=no matching secret key found in legacy secring.gpg for key or user id: {0}
gpgNoPublicKeyFound=Unable to find a public-key with key or user id: {0} gpgNoPublicKeyFound=Unable to find a public-key with key or user id: {0}
gpgNoSecretKeyForPublicKey=unable to find associated secret key for public key: {0} gpgNoSecretKeyForPublicKey=unable to find associated secret key for public key: {0}
gpgNotASigningKey=Secret key ({0}) is not suitable for signing
gpgKeyInfo=GPG Key (fingerprint {0}) gpgKeyInfo=GPG Key (fingerprint {0})
gpgSigningCancelled=Signing was cancelled gpgSigningCancelled=Signing was cancelled
headRequiredToStash=HEAD required to stash local changes headRequiredToStash=HEAD required to stash local changes

View File

@ -402,12 +402,8 @@ String describe(ObjectId tip) throws IOException {
if (candidates.isEmpty()) if (candidates.isEmpty())
return null; return null;
Candidate best = Collections.min(candidates, new Comparator<Candidate>() { Candidate best = Collections.min(candidates,
@Override (Candidate o1, Candidate o2) -> o1.depth - o2.depth);
public int compare(Candidate o1, Candidate o2) {
return o1.depth - o2.depth;
}
});
return best.describe(target); return best.describe(target);
} catch (IOException e) { } catch (IOException e) {

View File

@ -53,7 +53,6 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.GitAPIException;
@ -134,12 +133,8 @@ public List<Ref> call() throws GitAPIException {
throw new JGitInternalException(e.getMessage(), e); throw new JGitInternalException(e.getMessage(), e);
} }
Collections.sort(resultRefs, new Comparator<Ref>() { Collections.sort(resultRefs,
@Override (Ref o1, Ref o2) -> o1.getName().compareTo(o2.getName()));
public int compare(Ref o1, Ref o2) {
return o1.getName().compareTo(o2.getName());
}
});
setCallable(false); setCallable(false);
return resultRefs; return resultRefs;
} }

View File

@ -45,7 +45,6 @@
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.GitAPIException;
@ -87,12 +86,8 @@ public List<Ref> call() throws GitAPIException {
} catch (IOException e) { } catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e); throw new JGitInternalException(e.getMessage(), e);
} }
Collections.sort(tags, new Comparator<Ref>() { Collections.sort(tags,
@Override (Ref o1, Ref o2) -> o1.getName().compareTo(o2.getName()));
public int compare(Ref o1, Ref o2) {
return o1.getName().compareTo(o2.getName());
}
});
setCallable(false); setCallable(false);
return tags; return tags;
} }

View File

@ -111,14 +111,12 @@ public class DirCache {
private static final byte[] NO_CHECKSUM = {}; private static final byte[] NO_CHECKSUM = {};
static final Comparator<DirCacheEntry> ENT_CMP = new Comparator<DirCacheEntry>() { static final Comparator<DirCacheEntry> ENT_CMP = (DirCacheEntry o1,
@Override DirCacheEntry o2) -> {
public int compare(DirCacheEntry o1, DirCacheEntry o2) { final int cr = cmp(o1, o2);
final int cr = cmp(o1, o2); if (cr != 0)
if (cr != 0) return cr;
return cr; return o1.getStage() - o2.getStage();
return o1.getStage() - o2.getStage();
}
}; };
static int cmp(DirCacheEntry a, DirCacheEntry b) { static int cmp(DirCacheEntry a, DirCacheEntry b) {

View File

@ -75,13 +75,11 @@
* @see DirCacheBuilder * @see DirCacheBuilder
*/ */
public class DirCacheEditor extends BaseDirCacheEditor { public class DirCacheEditor extends BaseDirCacheEditor {
private static final Comparator<PathEdit> EDIT_CMP = new Comparator<PathEdit>() { private static final Comparator<PathEdit> EDIT_CMP = (PathEdit o1,
@Override PathEdit o2) -> {
public int compare(PathEdit o1, PathEdit o2) { final byte[] a = o1.path;
final byte[] a = o1.path; final byte[] b = o2.path;
final byte[] b = o2.path; return cmp(a, a.length, b, b.length);
return cmp(a, a.length, b, b.length);
}
}; };
private final List<PathEdit> edits; private final List<PathEdit> edits;

View File

@ -81,25 +81,26 @@ public class DirCacheTree {
private static final DirCacheTree[] NO_CHILDREN = {}; private static final DirCacheTree[] NO_CHILDREN = {};
private static final Comparator<DirCacheTree> TREE_CMP = new Comparator<DirCacheTree>() { private static final Comparator<DirCacheTree> TREE_CMP = (DirCacheTree o1,
@Override DirCacheTree o2) -> {
public int compare(DirCacheTree o1, DirCacheTree o2) { final byte[] a = o1.encodedName;
final byte[] a = o1.encodedName; final byte[] b = o2.encodedName;
final byte[] b = o2.encodedName; final int aLen = a.length;
final int aLen = a.length; final int bLen = b.length;
final int bLen = b.length; int cPos;
int cPos; for (cPos = 0; cPos < aLen && cPos < bLen; cPos++) {
for (cPos = 0; cPos < aLen && cPos < bLen; cPos++) { final int cmp = (a[cPos] & 0xff) - (b[cPos] & 0xff);
final int cmp = (a[cPos] & 0xff) - (b[cPos] & 0xff); if (cmp != 0) {
if (cmp != 0) return cmp;
return cmp;
} }
if (aLen == bLen)
return 0;
if (aLen < bLen)
return '/' - (b[cPos] & 0xff);
return (a[cPos] & 0xff) - '/';
} }
if (aLen == bLen) {
return 0;
}
if (aLen < bLen) {
return '/' - (b[cPos] & 0xff);
}
return (a[cPos] & 0xff) - '/';
}; };
/** Tree this tree resides in; null if we are the root. */ /** Tree this tree resides in; null if we are the root. */

View File

@ -391,6 +391,7 @@ public static JGitText get() {
/***/ public String gpgNoKeyInLegacySecring; /***/ public String gpgNoKeyInLegacySecring;
/***/ public String gpgNoPublicKeyFound; /***/ public String gpgNoPublicKeyFound;
/***/ public String gpgNoSecretKeyForPublicKey; /***/ public String gpgNoSecretKeyForPublicKey;
/***/ public String gpgNotASigningKey;
/***/ public String gpgKeyInfo; /***/ public String gpgKeyInfo;
/***/ public String gpgSigningCancelled; /***/ public String gpgSigningCancelled;
/***/ public String headRequiredToStash; /***/ public String headRequiredToStash;

View File

@ -385,12 +385,7 @@ private void initialize() throws IOException {
private void scheduleLeader() { private void scheduleLeader() {
idle = false; idle = false;
system.getExecutor().execute(new Runnable() { system.getExecutor().execute(this::runLeader);
@Override
public void run() {
runLeader();
}
});
} }
private void runLeader() { private void runLeader() {

View File

@ -123,21 +123,18 @@ void initialize(Repository repo) throws IOException {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected void startPush(ReplicaPushRequest req) { protected void startPush(ReplicaPushRequest req) {
getSystem().getExecutor().execute(new Runnable() { getSystem().getExecutor().execute(() -> {
@Override MonotonicClock clk = getSystem().getClock();
public void run() { try (Repository git = getLeader().openRepository();
MonotonicClock clk = getSystem().getClock(); ProposedTimestamp ts = clk.propose()) {
try (Repository git = getLeader().openRepository(); try {
ProposedTimestamp ts = clk.propose()) { update(git, req, ts);
try { req.done(git);
update(git, req, ts); } catch (Throwable err) {
req.done(git); req.setException(git, err);
} catch (Throwable err) {
req.setException(git, err);
}
} catch (IOException err) {
req.setException(null, err);
} }
} catch (IOException err) {
req.setException(null, err);
} }
}); });
} }

View File

@ -139,19 +139,16 @@ protected String describeForLog() {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected void startPush(ReplicaPushRequest req) { protected void startPush(ReplicaPushRequest req) {
getSystem().getExecutor().execute(new Runnable() { getSystem().getExecutor().execute(() -> {
@Override try (Repository git = getLeader().openRepository()) {
public void run() { try {
try (Repository git = getLeader().openRepository()) { push(git, req);
try { req.done(git);
push(git, req); } catch (Throwable err) {
req.done(git); req.setException(git, err);
} catch (Throwable err) {
req.setException(git, err);
}
} catch (IOException err) {
req.setException(null, err);
} }
} catch (IOException err) {
req.setException(null, err);
} }
}); });
} }

View File

@ -469,12 +469,8 @@ private List<ObjectIdWithOffset> toInclude(DfsPackFile src, DfsReader ctx)
continue SCAN; continue SCAN;
want.add(new ObjectIdWithOffset(id, ent.getOffset())); want.add(new ObjectIdWithOffset(id, ent.getOffset()));
} }
Collections.sort(want, new Comparator<ObjectIdWithOffset>() { Collections.sort(want, (ObjectIdWithOffset a,
@Override ObjectIdWithOffset b) -> Long.signum(a.offset - b.offset));
public int compare(ObjectIdWithOffset a, ObjectIdWithOffset b) {
return Long.signum(a.offset - b.offset);
}
});
return want; return want;
} }

View File

@ -287,14 +287,12 @@ public Set<ObjectId> getShallowCommits() {
return Collections.emptySet(); return Collections.emptySet();
} }
private static final Comparator<FoundObject<?>> FOUND_OBJECT_SORT = new Comparator<FoundObject<?>>() { private static final Comparator<FoundObject<?>> FOUND_OBJECT_SORT = (
@Override FoundObject<?> a, FoundObject<?> b) -> {
public int compare(FoundObject<?> a, FoundObject<?> b) { int cmp = a.packIndex - b.packIndex;
int cmp = a.packIndex - b.packIndex; if (cmp == 0)
if (cmp == 0) cmp = Long.signum(a.offset - b.offset);
cmp = Long.signum(a.offset - b.offset); return cmp;
return cmp;
}
}; };
private static class FoundObject<T extends ObjectId> { private static class FoundObject<T extends ObjectId> {
@ -565,12 +563,9 @@ public DfsObjectToPack newObjectToPack(AnyObjectId objectId, int type) {
return new DfsObjectToPack(objectId, type); return new DfsObjectToPack(objectId, type);
} }
private static final Comparator<DfsObjectToPack> OFFSET_SORT = new Comparator<DfsObjectToPack>() { private static final Comparator<DfsObjectToPack> OFFSET_SORT = (
@Override DfsObjectToPack a,
public int compare(DfsObjectToPack a, DfsObjectToPack b) { DfsObjectToPack b) -> Long.signum(a.getOffset() - b.getOffset());
return Long.signum(a.getOffset() - b.getOffset());
}
};
@Override @Override
public void selectObjectRepresentation(PackWriter packer, public void selectObjectRepresentation(PackWriter packer,

View File

@ -62,8 +62,6 @@
import org.eclipse.jgit.attributes.AttributesNode; import org.eclipse.jgit.attributes.AttributesNode;
import org.eclipse.jgit.attributes.AttributesNodeProvider; import org.eclipse.jgit.attributes.AttributesNodeProvider;
import org.eclipse.jgit.errors.ConfigInvalidException; import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.events.ConfigChangedEvent;
import org.eclipse.jgit.events.ConfigChangedListener;
import org.eclipse.jgit.events.IndexChangedEvent; import org.eclipse.jgit.events.IndexChangedEvent;
import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.ObjectDirectory.AlternateHandle; import org.eclipse.jgit.internal.storage.file.ObjectDirectory.AlternateHandle;
@ -206,12 +204,7 @@ public boolean isOutdated() {
loadUserConfig(); loadUserConfig();
loadRepoConfig(); loadRepoConfig();
repoConfig.addChangeListener(new ConfigChangedListener() { repoConfig.addChangeListener(this::fireEvent);
@Override
public void onConfigChanged(ConfigChangedEvent event) {
fireEvent(event);
}
});
final long repositoryFormatVersion = getConfig().getLong( final long repositoryFormatVersion = getConfig().getLong(
ConfigConstants.CONFIG_CORE_SECTION, null, ConfigConstants.CONFIG_CORE_SECTION, null,

View File

@ -116,12 +116,8 @@ static File getLockFile(File file) {
} }
/** Filter to skip over active lock files when listing a directory. */ /** Filter to skip over active lock files when listing a directory. */
static final FilenameFilter FILTER = new FilenameFilter() { static final FilenameFilter FILTER = (File dir,
@Override String name) -> !name.endsWith(LOCK_SUFFIX);
public boolean accept(File dir, String name) {
return !name.endsWith(LOCK_SUFFIX);
}
};
private final File ref; private final File ref;

View File

@ -45,7 +45,6 @@
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
@ -133,12 +132,8 @@ private static void sortByOffsetAndIndex(BlockList<PositionEntry> byOffset,
for (int i = 0; i < entries.size(); i++) { for (int i = 0; i < entries.size(); i++) {
positionEntries.add(new PositionEntry(entries.get(i), i)); positionEntries.add(new PositionEntry(entries.get(i), i));
} }
Collections.sort(entries, new Comparator<ObjectToPack>() { Collections.sort(entries, (ObjectToPack a, ObjectToPack b) -> Long
@Override .signum(a.getOffset() - b.getOffset()));
public int compare(ObjectToPack a, ObjectToPack b) {
return Long.signum(a.getOffset() - b.getOffset());
}
});
for (int i = 0; i < entries.size(); i++) { for (int i = 0; i < entries.size(); i++) {
PositionEntry e = positionEntries.get(entries.get(i)); PositionEntry e = positionEntries.get(entries.get(i));
e.offsetPosition = i; e.offsetPosition = i;
@ -310,57 +305,55 @@ public int getObjectCount() {
public Iterable<StoredEntry> getCompressedBitmaps() { public Iterable<StoredEntry> getCompressedBitmaps() {
// Add order is from oldest to newest. The reverse add order is the // Add order is from oldest to newest. The reverse add order is the
// output order. // output order.
return new Iterable<StoredEntry>() { return () -> new Iterator<StoredEntry>() {
private int index = byAddOrder.size() - 1;
@Override @Override
public Iterator<StoredEntry> iterator() { public boolean hasNext() {
return new Iterator<StoredEntry>() { return index >= 0;
private int index = byAddOrder.size() - 1; }
@Override @Override
public boolean hasNext() { public StoredEntry next() {
return index >= 0; if (!hasNext()) {
throw new NoSuchElementException();
}
StoredBitmap item = byAddOrder.get(index);
int bestXorOffset = 0;
EWAHCompressedBitmap bestBitmap = item.getBitmap();
// Attempt to compress the bitmap with an XOR of the
// previously written entries.
for (int i = 1; i <= MAX_XOR_OFFSET_SEARCH; i++) {
int curr = i + index;
if (curr >= byAddOrder.size()) {
break;
} }
@Override StoredBitmap other = byAddOrder.get(curr);
public StoredEntry next() { EWAHCompressedBitmap bitmap = other.getBitmap()
if (!hasNext()) .xor(item.getBitmap());
throw new NoSuchElementException();
StoredBitmap item = byAddOrder.get(index);
int bestXorOffset = 0;
EWAHCompressedBitmap bestBitmap = item.getBitmap();
// Attempt to compress the bitmap with an XOR of the if (bitmap.sizeInBytes() < bestBitmap.sizeInBytes()) {
// previously written entries. bestBitmap = bitmap;
for (int i = 1; i <= MAX_XOR_OFFSET_SEARCH; i++) { bestXorOffset = i;
int curr = i + index;
if (curr >= byAddOrder.size())
break;
StoredBitmap other = byAddOrder.get(curr);
EWAHCompressedBitmap bitmap = other.getBitmap()
.xor(item.getBitmap());
if (bitmap.sizeInBytes()
< bestBitmap.sizeInBytes()) {
bestBitmap = bitmap;
bestXorOffset = i;
}
}
index--;
PositionEntry entry = positionEntries.get(item);
if (entry == null)
throw new IllegalStateException();
bestBitmap.trim();
return new StoredEntry(entry.namePosition, bestBitmap,
bestXorOffset, item.getFlags());
} }
}
index--;
@Override PositionEntry entry = positionEntries.get(item);
public void remove() { if (entry == null) {
throw new UnsupportedOperationException(); throw new IllegalStateException();
} }
}; bestBitmap.trim();
return new StoredEntry(entry.namePosition, bestBitmap,
bestXorOffset, item.getFlags());
}
@Override
public void remove() {
throw new UnsupportedOperationException();
} }
}; };
} }

View File

@ -101,12 +101,8 @@
*/ */
public class PackFile implements Iterable<PackIndex.MutableEntry> { public class PackFile implements Iterable<PackIndex.MutableEntry> {
/** Sorts PackFiles to be most recently created to least recently created. */ /** Sorts PackFiles to be most recently created to least recently created. */
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() { public static final Comparator<PackFile> SORT = (PackFile a,
@Override PackFile b) -> b.packLastModified - a.packLastModified;
public int compare(PackFile a, PackFile b) {
return b.packLastModified - a.packLastModified;
}
};
private final File packFile; private final File packFile;

View File

@ -46,7 +46,6 @@
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -212,12 +211,8 @@ private ArrayList<WeightedPath> computeTopPaths() {
} }
// Sort by starting index to identify gaps later. // Sort by starting index to identify gaps later.
Collections.sort(topPaths, new Comparator<WeightedPath>() { Collections.sort(topPaths, (WeightedPath a,
@Override WeightedPath b) -> a.slice.beginIndex - b.slice.beginIndex);
public int compare(WeightedPath a, WeightedPath b) {
return a.slice.beginIndex - b.slice.beginIndex;
}
});
bytesPerUnit = 1; bytesPerUnit = 1;
while (MAX_METER <= (totalWeight / bytesPerUnit)) { while (MAX_METER <= (totalWeight / bytesPerUnit)) {

View File

@ -62,7 +62,6 @@
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -1418,32 +1417,33 @@ private void searchForDeltas(ProgressMonitor monitor)
// applies "Linus' Law" which states that newer files tend to be the // applies "Linus' Law" which states that newer files tend to be the
// bigger ones, because source files grow and hardly ever shrink. // bigger ones, because source files grow and hardly ever shrink.
// //
Arrays.sort(list, 0, cnt, new Comparator<ObjectToPack>() { Arrays.sort(list, 0, cnt, (ObjectToPack a, ObjectToPack b) -> {
@Override int cmp = (a.isDoNotDelta() ? 1 : 0) - (b.isDoNotDelta() ? 1 : 0);
public int compare(ObjectToPack a, ObjectToPack b) { if (cmp != 0) {
int cmp = (a.isDoNotDelta() ? 1 : 0) return cmp;
- (b.isDoNotDelta() ? 1 : 0);
if (cmp != 0)
return cmp;
cmp = a.getType() - b.getType();
if (cmp != 0)
return cmp;
cmp = (a.getPathHash() >>> 1) - (b.getPathHash() >>> 1);
if (cmp != 0)
return cmp;
cmp = (a.getPathHash() & 1) - (b.getPathHash() & 1);
if (cmp != 0)
return cmp;
cmp = (a.isEdge() ? 0 : 1) - (b.isEdge() ? 0 : 1);
if (cmp != 0)
return cmp;
return b.getWeight() - a.getWeight();
} }
cmp = a.getType() - b.getType();
if (cmp != 0) {
return cmp;
}
cmp = (a.getPathHash() >>> 1) - (b.getPathHash() >>> 1);
if (cmp != 0) {
return cmp;
}
cmp = (a.getPathHash() & 1) - (b.getPathHash() & 1);
if (cmp != 0) {
return cmp;
}
cmp = (a.isEdge() ? 0 : 1) - (b.isEdge() ? 0 : 1);
if (cmp != 0) {
return cmp;
}
return b.getWeight() - a.getWeight();
}); });
// Above we stored the objects we cannot delta onto the end. // Above we stored the objects we cannot delta onto the end.
@ -1564,14 +1564,11 @@ private void parallelDeltaSearch(ProgressMonitor monitor,
// asynchronous execution. Wrap everything and hope it // asynchronous execution. Wrap everything and hope it
// can schedule these for us. // can schedule these for us.
for (DeltaTask task : taskBlock.tasks) { for (DeltaTask task : taskBlock.tasks) {
executor.execute(new Runnable() { executor.execute(() -> {
@Override try {
public void run() { task.call();
try { } catch (Throwable failure) {
task.call(); errors.add(failure);
} catch (Throwable failure) {
errors.add(failure);
}
} }
}); });
} }

View File

@ -91,12 +91,9 @@ class PackWriterBitmapPreparer {
private static final int DAY_IN_SECONDS = 24 * 60 * 60; private static final int DAY_IN_SECONDS = 24 * 60 * 60;
private static final Comparator<RevCommit> ORDER_BY_REVERSE_TIMESTAMP = new Comparator<RevCommit>() { private static final Comparator<RevCommit> ORDER_BY_REVERSE_TIMESTAMP = (
@Override RevCommit a, RevCommit b) -> Integer
public int compare(RevCommit a, RevCommit b) { .signum(b.getCommitTime() - a.getCommitTime());
return Integer.signum(b.getCommitTime() - a.getCommitTime());
}
};
private final ObjectReader reader; private final ObjectReader reader;
private final ProgressMonitor pm; private final ProgressMonitor pm;

View File

@ -352,12 +352,7 @@ public interface WorkingTreeIteratorFactory {
public WorkingTreeIterator getWorkingTreeIterator(Repository repo); public WorkingTreeIterator getWorkingTreeIterator(Repository repo);
} }
private WorkingTreeIteratorFactory wTreeIt = new WorkingTreeIteratorFactory() { private WorkingTreeIteratorFactory wTreeIt = FileTreeIterator::new;
@Override
public WorkingTreeIterator getWorkingTreeIterator(Repository repo) {
return new FileTreeIterator(repo);
}
};
/** /**
* Allows higher layers to set the factory for WorkingTreeIterators. * Allows higher layers to set the factory for WorkingTreeIterators.

View File

@ -1277,11 +1277,8 @@ public DirCache lockDirCache() throws NoWorkTreeException,
CorruptObjectException, IOException { CorruptObjectException, IOException {
// we want DirCache to inform us so that we can inform registered // we want DirCache to inform us so that we can inform registered
// listeners about index changes // listeners about index changes
IndexChangedListener l = new IndexChangedListener() { IndexChangedListener l = (IndexChangedEvent event) -> {
@Override notifyIndexChanged(true);
public void onIndexChanged(IndexChangedEvent event) {
notifyIndexChanged(true);
}
}; };
return DirCache.lock(this, l); return DirCache.lock(this, l);
} }

View File

@ -255,14 +255,11 @@ private void configureEviction(
if (delay == RepositoryCacheConfig.NO_CLEANUP) { if (delay == RepositoryCacheConfig.NO_CLEANUP) {
return; return;
} }
cleanupTask = scheduler.scheduleWithFixedDelay(new Runnable() { cleanupTask = scheduler.scheduleWithFixedDelay(() -> {
@Override try {
public void run() { cache.clearAllExpired();
try { } catch (Throwable e) {
cache.clearAllExpired(); LOG.error(e.getMessage(), e);
} catch (Throwable e) {
LOG.error(e.getMessage(), e);
}
} }
}, delay, delay, TimeUnit.MILLISECONDS); }, delay, delay, TimeUnit.MILLISECONDS);
} }

View File

@ -181,10 +181,11 @@ private boolean containsSigningKey(String userId) {
private PGPPublicKey findPublicKeyByKeyId(KeyBlob keyBlob) private PGPPublicKey findPublicKeyByKeyId(KeyBlob keyBlob)
throws IOException { throws IOException {
String keyId = signingKey.toLowerCase(Locale.ROOT);
for (KeyInformation keyInfo : keyBlob.getKeyInformation()) { for (KeyInformation keyInfo : keyBlob.getKeyInformation()) {
if (signingKey.toLowerCase(Locale.ROOT) String fingerprint = Hex.toHexString(keyInfo.getFingerprint())
.equals(Hex.toHexString(keyInfo.getKeyID()) .toLowerCase(Locale.ROOT);
.toLowerCase(Locale.ROOT))) { if (fingerprint.endsWith(keyId)) {
return getFirstPublicKey(keyBlob); return getFirstPublicKey(keyBlob);
} }
} }
@ -260,6 +261,10 @@ public BouncyCastleGpgKey findSecretKey()
USER_PGP_LEGACY_SECRING_FILE); USER_PGP_LEGACY_SECRING_FILE);
if (secretKey != null) { if (secretKey != null) {
if (!secretKey.isSigningKey()) {
throw new PGPException(MessageFormat.format(
JGitText.get().gpgNotASigningKey, signingKey));
}
return new BouncyCastleGpgKey(secretKey, USER_PGP_LEGACY_SECRING_FILE); return new BouncyCastleGpgKey(secretKey, USER_PGP_LEGACY_SECRING_FILE);
} }
@ -293,6 +298,10 @@ private BouncyCastleGpgKey findSecretKeyForKeyBoxPublicKey(
PGPSecretKey secretKey = attemptParseSecretKey(keyFile, PGPSecretKey secretKey = attemptParseSecretKey(keyFile,
calculatorProvider, passphraseProvider, publicKey); calculatorProvider, passphraseProvider, publicKey);
if (secretKey != null) { if (secretKey != null) {
if (!secretKey.isSigningKey()) {
throw new PGPException(MessageFormat.format(
JGitText.get().gpgNotASigningKey, signingKey));
}
return new BouncyCastleGpgKey(secretKey, userKeyboxPath); return new BouncyCastleGpgKey(secretKey, userKeyboxPath);
} }
} }
@ -334,6 +343,7 @@ private PGPSecretKey findSecretKeyInLegacySecring(String signingkey,
PGPUtil.getDecoderStream(new BufferedInputStream(in)), PGPUtil.getDecoderStream(new BufferedInputStream(in)),
new JcaKeyFingerprintCalculator()); new JcaKeyFingerprintCalculator());
String keyId = signingkey.toLowerCase(Locale.ROOT);
Iterator<PGPSecretKeyRing> keyrings = pgpSec.getKeyRings(); Iterator<PGPSecretKeyRing> keyrings = pgpSec.getKeyRings();
while (keyrings.hasNext()) { while (keyrings.hasNext()) {
PGPSecretKeyRing keyRing = keyrings.next(); PGPSecretKeyRing keyRing = keyrings.next();
@ -344,8 +354,7 @@ private PGPSecretKey findSecretKeyInLegacySecring(String signingkey,
String fingerprint = Hex String fingerprint = Hex
.toHexString(key.getPublicKey().getFingerprint()) .toHexString(key.getPublicKey().getFingerprint())
.toLowerCase(Locale.ROOT); .toLowerCase(Locale.ROOT);
if (fingerprint if (fingerprint.endsWith(keyId)) {
.endsWith(signingkey.toLowerCase(Locale.ROOT))) {
return key; return key;
} }
// try user id // try user id

View File

@ -0,0 +1,93 @@
package org.eclipse.jgit.revwalk;
import static java.util.Objects.requireNonNull;
import java.io.IOException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.internal.revwalk.AddToBitmapFilter;
import org.eclipse.jgit.lib.BitmapIndex;
import org.eclipse.jgit.lib.BitmapIndex.Bitmap;
import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder;
import org.eclipse.jgit.lib.ProgressMonitor;
/**
* Calculate the bitmap indicating what other commits are reachable from certain
* commit.
* <p>
* This bitmap refers only to commits. For a bitmap with ALL objects reachable
* from certain object, see {@code BitmapWalker}.
*/
class BitmapCalculator {
private final RevWalk walk;
private final BitmapIndex bitmapIndex;
BitmapCalculator(RevWalk walk) throws IOException {
this.walk = walk;
this.bitmapIndex = requireNonNull(
walk.getObjectReader().getBitmapIndex());
}
/**
* Get the reachability bitmap from certain commit to other commits.
* <p>
* This will return a precalculated bitmap if available or walk building one
* until finding a precalculated bitmap (and returning the union).
* <p>
* Beware that the returned bitmap it is guaranteed to include ONLY the
* commits reachable from the initial commit. It COULD include other objects
* (because precalculated bitmaps have them) but caller shouldn't count on
* that. See {@link BitmapWalker} for a full reachability bitmap.
*
* @param start
* the commit. Use {@code walk.parseCommit(objectId)} to get this
* object from the id.
* @param pm
* progress monitor. Updated by one per commit browsed in the
* graph
* @return the bitmap of reachable commits (and maybe some extra objects)
* for the commit
* @throws MissingObjectException
* the supplied id doesn't exist
* @throws IncorrectObjectTypeException
* the supplied id doens't refer to a commit or a tag
* @throws IOException
*/
BitmapBuilder getBitmap(RevCommit start, ProgressMonitor pm)
throws MissingObjectException,
IncorrectObjectTypeException, IOException {
Bitmap precalculatedBitmap = bitmapIndex.getBitmap(start);
if (precalculatedBitmap != null) {
return asBitmapBuilder(precalculatedBitmap);
}
walk.reset();
walk.sort(RevSort.TOPO);
walk.markStart(start);
// Unbounded walk. If the repo has bitmaps, it should bump into one at
// some point.
BitmapBuilder bitmapResult = bitmapIndex.newBitmapBuilder();
walk.setRevFilter(new AddToBitmapFilter(bitmapResult));
while (walk.next() != null) {
// Iterate through all of the commits. The BitmapRevFilter does
// the work.
//
// filter.include returns true for commits that do not have
// a bitmap in bitmapIndex and are not reachable from a
// bitmap in bitmapIndex encountered earlier in the walk.
// Thus the number of commits returned by next() measures how
// much history was traversed without being able to make use
// of bitmaps.
pm.update(1);
}
return bitmapResult;
}
private BitmapBuilder asBitmapBuilder(Bitmap bitmap) {
return bitmapIndex.newBitmapBuilder().or(bitmap);
}
}

View File

@ -0,0 +1,122 @@
/*
* Copyright (C) 2019, 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.revwalk;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder;
import org.eclipse.jgit.lib.NullProgressMonitor;
/**
* Checks the reachability using bitmaps.
*
* @since 5.4
*/
public class BitmappedReachabilityChecker implements ReachabilityChecker {
private final RevWalk walk;
/**
* @param walk
* walk on the repository to get or create the bitmaps for the
* commits. It must have bitmaps.
* @throws AssertionError
* runtime exception if walk is over a repository without
* bitmaps
* @throws IOException
* if the index or the object reader cannot be opened.
*/
public BitmappedReachabilityChecker(RevWalk walk)
throws IOException {
this.walk = walk;
if (walk.getObjectReader().getBitmapIndex() == null) {
throw new AssertionError(
"Trying to use bitmapped reachability check " //$NON-NLS-1$
+ "on a repository without bitmaps"); //$NON-NLS-1$
}
}
/**
* Check all targets are reachable from the starters.
* <p>
* In this implementation, it is recommended to put the most popular
* starters (e.g. refs/heads tips) at the beginning of the collection
*/
@Override
public Optional<RevCommit> areAllReachable(Collection<RevCommit> targets,
Collection<RevCommit> starters) throws MissingObjectException,
IncorrectObjectTypeException, IOException {
BitmapCalculator calculator = new BitmapCalculator(walk);
/**
* Iterate over starters bitmaps and remove targets as they become
* reachable.
*
* Building the total starters bitmap has the same cost (iterating over
* all starters adding the bitmaps) and this gives us the chance to
* shorcut the loop.
*
* This is based on the assuption that most of the starters will have
* the reachability bitmap precalculated. If many require a walk, the
* walk.reset() could start to take too much time.
*/
List<RevCommit> remainingTargets = new ArrayList<>(targets);
for (RevCommit starter : starters) {
BitmapBuilder starterBitmap = calculator.getBitmap(starter,
NullProgressMonitor.INSTANCE);
remainingTargets.removeIf(starterBitmap::contains);
if (remainingTargets.isEmpty()) {
return Optional.empty();
}
}
return Optional.of(remainingTargets.get(0));
}
}

View File

@ -0,0 +1,98 @@
/*
* Copyright (C) 2019, 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.revwalk;
import java.io.IOException;
import java.util.Collection;
import java.util.Optional;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
/**
* Checks the reachability walking the graph from the starters towards the
* target.
*
* @since 5.4
*/
public class PedestrianReachabilityChecker implements ReachabilityChecker {
private final boolean topoSort;
private final RevWalk walk;
/**
* New instance of the reachability checker using a existing walk.
*
* @param topoSort
* walk commits in topological order
* @param walk
* RevWalk instance to reuse. Caller retains ownership.
*/
public PedestrianReachabilityChecker(boolean topoSort,
RevWalk walk) {
this.topoSort = topoSort;
this.walk = walk;
}
@Override
public Optional<RevCommit> areAllReachable(Collection<RevCommit> targets,
Collection<RevCommit> starters)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
walk.reset();
if (topoSort) {
walk.sort(RevSort.TOPO);
}
for (RevCommit target: targets) {
walk.markStart(target);
}
for (RevCommit starter : starters) {
walk.markUninteresting(starter);
}
return Optional.ofNullable(walk.next());
}
}

View File

@ -0,0 +1,90 @@
/*
* Copyright (C) 2019, 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.revwalk;
import java.io.IOException;
import java.util.Collection;
import java.util.Optional;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
/**
* Check if a commit is reachable from a collection of starting commits.
* <p>
* Note that this checks the reachability of commits (and tags). Trees, blobs or
* any other object will cause IncorrectObjectTypeException exceptions.
*
* @since 5.4
*/
public interface ReachabilityChecker {
/**
* Check if all targets are reachable from the {@code starter} commits.
* <p>
* Caller should parse the objectIds (preferably with
* {@code walk.parseCommit()} and handle missing/incorrect type objects
* before calling this method.
*
* @param targets
* commits to reach.
* @param starters
* known starting points.
* @return An unreachable target if at least one of the targets is
* unreachable. An empty optional if all targets are reachable from
* the starters.
*
* @throws MissingObjectException
* if any of the incoming objects doesn't exist in the
* repository.
* @throws IncorrectObjectTypeException
* if any of the incoming objects is not a commit or a tag.
* @throws IOException
* if any of the underlying indexes or readers can not be
* opened.
*/
Optional<RevCommit> areAllReachable(Collection<RevCommit> targets,
Collection<RevCommit> starters)
throws MissingObjectException, IncorrectObjectTypeException,
IOException;
}

View File

@ -115,36 +115,26 @@ public Daemon(InetSocketAddress addr) {
repositoryResolver = (RepositoryResolver<DaemonClient>) RepositoryResolver.NONE; repositoryResolver = (RepositoryResolver<DaemonClient>) RepositoryResolver.NONE;
uploadPackFactory = new UploadPackFactory<DaemonClient>() { uploadPackFactory = (DaemonClient req, Repository db) -> {
@Override UploadPack up = new UploadPack(db);
public UploadPack create(DaemonClient req, Repository db) up.setTimeout(getTimeout());
throws ServiceNotEnabledException, up.setPackConfig(getPackConfig());
ServiceNotAuthorizedException { return up;
UploadPack up = new UploadPack(db);
up.setTimeout(getTimeout());
up.setPackConfig(getPackConfig());
return up;
}
}; };
receivePackFactory = new ReceivePackFactory<DaemonClient>() { receivePackFactory = (DaemonClient req, Repository db) -> {
@Override ReceivePack rp = new ReceivePack(db);
public ReceivePack create(DaemonClient req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
ReceivePack rp = new ReceivePack(db);
InetAddress peer = req.getRemoteAddress(); InetAddress peer = req.getRemoteAddress();
String host = peer.getCanonicalHostName(); String host = peer.getCanonicalHostName();
if (host == null) if (host == null)
host = peer.getHostAddress(); host = peer.getHostAddress();
String name = "anonymous"; //$NON-NLS-1$ String name = "anonymous"; //$NON-NLS-1$
String email = name + "@" + host; //$NON-NLS-1$ String email = name + "@" + host; //$NON-NLS-1$
rp.setRefLogIdent(new PersonIdent(name, email)); rp.setRefLogIdent(new PersonIdent(name, email));
rp.setTimeout(getTimeout()); rp.setTimeout(getTimeout());
return rp; return rp;
}
}; };
services = new DaemonService[] { services = new DaemonService[] {

View File

@ -63,12 +63,9 @@
*/ */
public interface PostReceiveHook { public interface PostReceiveHook {
/** A simple no-op hook. */ /** A simple no-op hook. */
PostReceiveHook NULL = new PostReceiveHook() { PostReceiveHook NULL = (final ReceivePack rp,
@Override final Collection<ReceiveCommand> commands) -> {
public void onPostReceive(final ReceivePack rp, // Do nothing.
final Collection<ReceiveCommand> commands) {
// Do nothing.
}
}; };
/** /**

View File

@ -57,11 +57,8 @@
*/ */
public interface PostUploadHook { public interface PostUploadHook {
/** A simple no-op hook. */ /** A simple no-op hook. */
PostUploadHook NULL = new PostUploadHook() { PostUploadHook NULL = (PackStatistics stats) -> {
@Override // Do nothing.
public void onPostUpload(PackStatistics stats) {
// Do nothing.
}
}; };
/** /**

View File

@ -79,12 +79,9 @@
*/ */
public interface PreReceiveHook { public interface PreReceiveHook {
/** A simple no-op hook. */ /** A simple no-op hook. */
PreReceiveHook NULL = new PreReceiveHook() { PreReceiveHook NULL = (final ReceivePack rp,
@Override final Collection<ReceiveCommand> commands) -> {
public void onPreReceive(final ReceivePack rp, // Do nothing.
final Collection<ReceiveCommand> commands) {
// Do nothing.
}
}; };
/** /**

View File

@ -57,7 +57,6 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -193,81 +192,78 @@ public PushCertificate get(String refName) throws IOException {
* close resources. * close resources.
*/ */
public Iterable<PushCertificate> getAll(String refName) { public Iterable<PushCertificate> getAll(String refName) {
return new Iterable<PushCertificate>() { return () -> new Iterator<PushCertificate>() {
@Override private final String path = pathName(refName);
public Iterator<PushCertificate> iterator() {
return new Iterator<PushCertificate>() {
private final String path = pathName(refName);
private PushCertificate next;
private RevWalk rw; private PushCertificate next;
{
private RevWalk rw;
{
try {
if (reader == null) {
load();
}
if (commit != null) {
rw = new RevWalk(reader);
rw.setTreeFilter(AndTreeFilter.create(
PathFilterGroup.create(Collections
.singleton(PathFilter.create(path))),
TreeFilter.ANY_DIFF));
rw.setRewriteParents(false);
rw.markStart(rw.parseCommit(commit));
} else {
rw = null;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public boolean hasNext() {
try {
if (next == null) {
if (rw == null) {
return false;
}
try { try {
if (reader == null) { RevCommit c = rw.next();
load(); if (c != null) {
} try (TreeWalk tw = TreeWalk.forPath(
if (commit != null) { rw.getObjectReader(), path,
rw = new RevWalk(reader); c.getTree())) {
rw.setTreeFilter(AndTreeFilter.create( next = read(tw);
PathFilterGroup.create( }
Collections.singleton(PathFilter.create(path))),
TreeFilter.ANY_DIFF));
rw.setRewriteParents(false);
rw.markStart(rw.parseCommit(commit));
} else { } else {
rw = null; next = null;
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
return next != null;
@Override } finally {
public boolean hasNext() { if (next == null && rw != null) {
try { rw.close();
if (next == null) { rw = null;
if (rw == null) {
return false;
}
try {
RevCommit c = rw.next();
if (c != null) {
try (TreeWalk tw = TreeWalk.forPath(
rw.getObjectReader(), path, c.getTree())) {
next = read(tw);
}
} else {
next = null;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return next != null;
} finally {
if (next == null && rw != null) {
rw.close();
rw = null;
}
}
} }
}
}
@Override @Override
public PushCertificate next() { public PushCertificate next() {
hasNext(); hasNext();
PushCertificate n = next; PushCertificate n = next;
if (n == null) { if (n == null) {
throw new NoSuchElementException(); throw new NoSuchElementException();
} }
next = null; next = null;
return n; return n;
} }
@Override @Override
public void remove() { public void remove() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
}
};
} }
}; };
} }
@ -442,13 +438,8 @@ private ObjectId write() throws IOException {
} }
private static void sortPending(List<PendingCert> pending) { private static void sortPending(List<PendingCert> pending) {
Collections.sort(pending, new Comparator<PendingCert>() { Collections.sort(pending, (PendingCert a, PendingCert b) -> Long.signum(
@Override a.ident.getWhen().getTime() - b.ident.getWhen().getTime()));
public int compare(PendingCert a, PendingCert b) {
return Long.signum(
a.ident.getWhen().getTime() - b.ident.getWhen().getTime());
}
});
} }
private DirCache newDirCache() throws IOException { private DirCache newDirCache() throws IOException {

View File

@ -61,12 +61,7 @@ public interface RefFilter {
/** /**
* The default filter, allows all refs to be shown. * The default filter, allows all refs to be shown.
*/ */
RefFilter DEFAULT = new RefFilter() { RefFilter DEFAULT = (Map<String, Ref> refs) -> refs;
@Override
public Map<String, Ref> filter (Map<String, Ref> refs) {
return refs;
}
};
/** /**
* Filters a {@code Map} of refs before it is advertised to the client. * Filters a {@code Map} of refs before it is advertised to the client.

Some files were not shown because too many files have changed in this diff Show More