From 61ec1455c000024c53425fe84bfb238880e46c8d Mon Sep 17 00:00:00 2001 From: Lajos Olah Date: Tue, 25 Feb 2020 17:17:02 -0500 Subject: [PATCH 01/16] Do not fail if known hosts file does not contain valid host key KnownHosts (implementing HostKeyRepository) in Jsch can return null which could cause NullPointerException in Stream.of(...) Change-Id: Iddcf5f34f8c8475a85ca7ae018bbe48d1b3fbbc0 Signed-off-by: Lajos Olah --- .../eclipse/jgit/transport/JschConfigSessionFactory.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java index faa917a50..718c8f611 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java @@ -219,7 +219,13 @@ public abstract class JschConfigSessionFactory extends SshSessionFactory { private static void setPreferredKeyTypesOrder(Session session) { HostKeyRepository hkr = session.getHostKeyRepository(); - List known = Stream.of(hkr.getHostKey(hostName(session), null)) + HostKey[] hostKeys = hkr.getHostKey(hostName(session), null); + + if (hostKeys == null) { + return; + } + + List known = Stream.of(hostKeys) .map(HostKey::getType) .collect(toList()); From e40c38ab08837473375c571c2f07ab680fc1985d Mon Sep 17 00:00:00 2001 From: Alex Spradlin Date: Wed, 26 Feb 2020 13:49:41 -0500 Subject: [PATCH 02/16] Revert "RevWalk: stop mixing lines of history in topo sort" This reverts commit b5e764abd21bd4593287361a625ecc49bc0efd77. PlotWalk uses the TopoSortGenerator, which is causing problems for EGit users who rely on the emission of commits being somewhat based on date as in the previous topo-sort algorithm. Bug: 560529 Change-Id: I3dbd3598a7aeb960de3fc39352699b4f11a8c226 Signed-off-by: Alex Spradlin --- .../eclipse/jgit/api/RebaseCommandTest.java | 4 +- .../jgit/revplot/PlotCommitListTest.java | 92 +++++++-------- .../eclipse/jgit/revwalk/RevWalkSortTest.java | 106 ------------------ .../org/eclipse/jgit/revwalk/RevObject.java | 2 +- .../src/org/eclipse/jgit/revwalk/RevWalk.java | 8 +- .../jgit/revwalk/TopoSortGenerator.java | 44 +++----- 6 files changed, 64 insertions(+), 192 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java index d1522e98e..86239023d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java @@ -563,10 +563,10 @@ public class RebaseCommandTest extends RepositoryTestCase { RevCommit newD = rw.next(); assertDerivedFrom(newD, d); assertEquals(2, newD.getParentCount()); - RevCommit newE = rw.next(); - assertEquals(e, newE); RevCommit newC = rw.next(); assertDerivedFrom(newC, c); + RevCommit newE = rw.next(); + assertEquals(e, newE); assertEquals(newC, newD.getParent(0)); assertEquals(e, newD.getParent(1)); assertEquals(g, rw.next()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java index 45225a2bd..4e0bba2f2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java @@ -254,12 +254,12 @@ public class PlotCommitListTest extends RevWalkTestCase { int posI = test.commit(i).lanePos(childPositions).parents(h) .getLanePos(); test.commit(h).lanePos(posI).parents(f); + test.commit(g).lanePos(childPositions).parents(a); test.commit(f).lanePos(posI).parents(e, d); - test.commit(d).lanePos(1).parents(b); test.commit(e).lanePos(posI).parents(c); + test.commit(d).lanePos(2).parents(b); test.commit(c).lanePos(posI).parents(b); test.commit(b).lanePos(posI).parents(a); - test.commit(g).lanePos(childPositions).parents(a); test.commit(a).lanePos(0).parents(); } } @@ -325,42 +325,42 @@ public class PlotCommitListTest extends RevWalkTestCase { .lanePos(mainPos); test.commit(merge_update_eclipse) .parents(add_a_clear, update_eclipse).lanePos(mainPos); - test.commit(update_eclipse).parents(add_Maven).lanePos(2); test.commit(add_a_clear).parents(fix_broken).lanePos(mainPos); test.commit(fix_broken).parents(merge_disable_comment) .lanePos(mainPos); test.commit(merge_disable_comment) .parents(merge_resolve_handler, disable_comment) .lanePos(mainPos); - test.commit(disable_comment).parents(clone_operation).lanePos(3); + test.commit(disable_comment).parents(clone_operation).lanePos(2); test.commit(merge_resolve_handler) .parents(clone_operation, resolve_handler).lanePos(mainPos); - test.commit(resolve_handler).parents(merge_fix).lanePos(4); + test.commit(update_eclipse).parents(add_Maven).lanePos(3); test.commit(clone_operation).parents(merge_changeset_implementation) .lanePos(mainPos); test.commit(merge_changeset_implementation) .parents(merge_disable_source, changeset_implementation) .lanePos(mainPos); - test.commit(changeset_implementation).parents(clear_repositorycache) - .lanePos(1); test.commit(merge_disable_source) .parents(update_eclipse_iplog2, disable_source) .lanePos(mainPos); - test.commit(disable_source).parents(merge_use_remote).lanePos(3); test.commit(update_eclipse_iplog2).parents(merge_use_remote) .lanePos(mainPos); + test.commit(disable_source).parents(merge_use_remote).lanePos(1); test.commit(merge_use_remote) .parents(update_eclipse_iplog, use_remote).lanePos(mainPos); - test.commit(use_remote).parents(clear_repositorycache).lanePos(3); + test.commit(changeset_implementation).parents(clear_repositorycache) + .lanePos(2); test.commit(update_eclipse_iplog).parents(merge_add_Maven) .lanePos(mainPos); test.commit(merge_add_Maven).parents(findToolBar_layout, add_Maven) .lanePos(mainPos); - test.commit(add_Maven).parents(clear_repositorycache).lanePos(2); test.commit(findToolBar_layout).parents(clear_repositorycache) .lanePos(mainPos); + test.commit(use_remote).parents(clear_repositorycache).lanePos(1); + test.commit(add_Maven).parents(clear_repositorycache).lanePos(3); test.commit(clear_repositorycache).parents(merge_remove) .lanePos(mainPos); + test.commit(resolve_handler).parents(merge_fix).lanePos(4); test.commit(merge_remove).parents(add_simple, remove_unused) .lanePos(mainPos); test.commit(remove_unused).parents(merge_fix).lanePos(1); @@ -453,36 +453,33 @@ public class PlotCommitListTest extends RevWalkTestCase { pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); - Set positions = asSet(0, 1); - CommitListAssert test = new CommitListAssert(pcl); - int posA = test.commit(a5).lanePos(positions).getLanePos(); - test.commit(a4); - test.commit(a3).lanePos(posA); - test.commit(e); - test.commit(d); - test.commit(a2).lanePos(posA); - int posB = test.commit(b3).lanePos(positions).getLanePos(); - test.commit(b2).lanePos(posB); - test.commit(b1).lanePos(posB); - test.commit(c); - test.commit(a1).lanePos(posA); - test.noMoreCommits(); - assertNotEquals("a lane is the same as b lane", posA, posB); + // test that the commits b1, b2 and b3 are on the same position + int bPos = pcl.get(9).lane.position; // b1 + assertEquals("b2 is an a different position", bPos, + pcl.get(7).lane.position); + assertEquals("b3 is on a different position", bPos, + pcl.get(4).lane.position); + + // test that nothing blocks the connections between b1, b2 and b3 + assertNotEquals("b lane is blocked by c", bPos, + pcl.get(8).lane.position); + assertNotEquals("b lane is blocked by a2", bPos, + pcl.get(6).lane.position); + assertNotEquals("b lane is blocked by d", bPos, + pcl.get(5).lane.position); } } /** *
 	 *    b3
-	 * a5 |
-	 * |  |
 	 * a4 |
 	 * | \|
 	 * |  b2
 	 * a3 |
 	 * | \|
-	 * |  b1
 	 * a2 |
+	 * |  b1
 	 * | /
 	 * a1
 	 * 
@@ -497,11 +494,10 @@ public class PlotCommitListTest extends RevWalkTestCase { final RevCommit a3 = commit(a2, b1); final RevCommit b2 = commit(b1); final RevCommit a4 = commit(a3, b2); - final RevCommit a5 = commit(a4); final RevCommit b3 = commit(b2); try (PlotWalk pw = new PlotWalk(db)) { - pw.markStart(pw.lookupCommit(a5)); + pw.markStart(pw.lookupCommit(a4)); pw.markStart(pw.lookupCommit(b3)); PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); @@ -510,12 +506,11 @@ public class PlotCommitListTest extends RevWalkTestCase { Set positions = asSet(0, 1); CommitListAssert test = new CommitListAssert(pcl); int posB = test.commit(b3).lanePos(positions).getLanePos(); - int posA = test.commit(a5).lanePos(positions).getLanePos(); - test.commit(a4).lanePos(posA); + int posA = test.commit(a4).lanePos(positions).getLanePos(); test.commit(b2).lanePos(posB); test.commit(a3).lanePos(posA); - test.commit(b1).lanePos(posB); test.commit(a2).lanePos(posA); + test.commit(b1).lanePos(posB); test.commit(a1).lanePos(posA); test.noMoreCommits(); } @@ -524,17 +519,13 @@ public class PlotCommitListTest extends RevWalkTestCase { /** *
 	 * a4
-	 * |
-	 * a3
-	 * | \\
-	 * a2  \\
-	 * |    \\
-	 * |  b3 ||
-	 * |  |  ||
-	 * |  b2 ||
-	 * |  | //
-	 * |  b1
-	 * |  |
+	 * |   b3
+	 * a3  |
+	 * | \\|
+	 * |   |\\
+	 * |   b2||
+	 * a2  | //
+	 * |   b1
 	 * | /
 	 * a1
 	 * 
@@ -561,10 +552,10 @@ public class PlotCommitListTest extends RevWalkTestCase { Set positions = asSet(0, 1); CommitListAssert test = new CommitListAssert(pcl); int posA = test.commit(a4).lanePos(positions).getLanePos(); - test.commit(a3).lanePos(posA); - test.commit(a2).lanePos(posA); int posB = test.commit(b3).lanePos(positions).getLanePos(); + test.commit(a3).lanePos(posA); test.commit(b2).lanePos(posB); + test.commit(a2).lanePos(posA); // b1 is not repositioned, uses "detour lane" // (drawn as a double arc in the ascii graph above) test.commit(b1).lanePos(posB); @@ -578,14 +569,13 @@ public class PlotCommitListTest extends RevWalkTestCase { * b2 * a4 | * | \ | - * | b1 - * a3 | + * a3 \| * | \ | * | c | * | / | * a2 | - * | | - * | / + * | b1 + * / * | / * a1 * @@ -614,10 +604,10 @@ public class PlotCommitListTest extends RevWalkTestCase { CommitListAssert test = new CommitListAssert(pcl); int posB = test.commit(b2).lanePos(positions).getLanePos(); int posA = test.commit(a4).lanePos(positions).getLanePos(); - test.commit(b1).lanePos(posB); // repositioned to go around c test.commit(a3).lanePos(posA); test.commit(c).lanePos(positions); test.commit(a2).lanePos(posA); + test.commit(b1).lanePos(posB); // repositioned to go around c test.commit(a1).lanePos(posA); test.noMoreCommits(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkSortTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkSortTest.java index 3f29e09e3..6f110fa31 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkSortTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkSortTest.java @@ -144,110 +144,4 @@ public class RevWalkSortTest extends RevWalkTestCase { assertCommit(d, rw.next()); assertNull(rw.next()); } - - @Test - public void testSort_TOPO_OutOfOrderCommitTimes() throws Exception { - // b is committed before c2 in a different line of history. - // - final RevCommit a = commit(); - final RevCommit c1 = commit(a); - final RevCommit b = commit(a); - final RevCommit c2 = commit(c1); - final RevCommit d = commit(b, c2); - - rw.sort(RevSort.TOPO); - markStart(d); - assertCommit(d, rw.next()); - assertCommit(c2, rw.next()); - assertCommit(c1, rw.next()); - assertCommit(b, rw.next()); - assertCommit(a, rw.next()); - assertNull(rw.next()); - } - - @Test - public void testSort_TOPO_MultipleLinesOfHistory() throws Exception { - final RevCommit a1 = commit(); - final RevCommit b1 = commit(a1); - final RevCommit a2 = commit(a1, b1); - final RevCommit b2 = commit(b1); - final RevCommit b3 = commit(b1); - final RevCommit a3 = commit(a2, b2); - final RevCommit a4 = commit(a3, b3); - - rw.sort(RevSort.TOPO); - markStart(a4); - assertCommit(a4, rw.next()); - assertCommit(b3, rw.next()); - assertCommit(a3, rw.next()); - assertCommit(b2, rw.next()); - assertCommit(a2, rw.next()); - assertCommit(b1, rw.next()); - assertCommit(a1, rw.next()); - assertNull(rw.next()); - } - - @Test - public void testSort_TOPO_REVERSE_MultipleLinesOfHistory() - throws Exception { - final RevCommit a1 = commit(); - final RevCommit b1 = commit(a1); - final RevCommit a2 = commit(a1, b1); - final RevCommit b2 = commit(b1); - final RevCommit b3 = commit(b1); - final RevCommit a3 = commit(a2, b2); - final RevCommit a4 = commit(a3, b3); - - rw.sort(RevSort.TOPO); - rw.sort(RevSort.REVERSE, true); - markStart(a4); - assertCommit(a1, rw.next()); - assertCommit(b1, rw.next()); - assertCommit(a2, rw.next()); - assertCommit(b2, rw.next()); - assertCommit(a3, rw.next()); - assertCommit(b3, rw.next()); - assertCommit(a4, rw.next()); - assertNull(rw.next()); - } - - @Test - public void testSort_TOPO_ParentOfMultipleStartChildren() throws Exception { - final RevCommit a = commit(); - final RevCommit b = commit(a); - final RevCommit c = commit(a); - final RevCommit d1 = commit(a); - final RevCommit d2 = commit(d1); - final RevCommit e = commit(a); - - rw.sort(RevSort.TOPO); - markStart(b); - markStart(c); - markStart(d2); - markStart(e); - assertCommit(e, rw.next()); - assertCommit(d2, rw.next()); - assertCommit(d1, rw.next()); - assertCommit(c, rw.next()); - assertCommit(b, rw.next()); - assertCommit(a, rw.next()); - assertNull(rw.next()); - } - - @Test - public void testSort_TOPO_Uninteresting() throws Exception { - final RevCommit a1 = commit(); - final RevCommit a2 = commit(a1); - final RevCommit a3 = commit(a2); - final RevCommit b = commit(a1); - final RevCommit a4 = commit(a3, b); - - rw.sort(RevSort.TOPO); - markStart(a4); - markUninteresting(a2); - assertCommit(a4, rw.next()); - assertCommit(b, rw.next()); - assertCommit(a3, rw.next()); - assertNull(rw.next()); - } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java index 1abcf6962..5ce4bc33b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java @@ -151,7 +151,7 @@ public abstract class RevObject extends ObjectIdOwnerMap.Entry { * buffer to append a debug description of core RevFlags onto. */ protected void appendCoreFlags(StringBuilder s) { - s.append((flags & RevWalk.TOPO_QUEUED) != 0 ? 'o' : '-'); + s.append((flags & RevWalk.TOPO_DELAY) != 0 ? 'o' : '-'); s.append((flags & RevWalk.TEMP_MARK) != 0 ? 't' : '-'); s.append((flags & RevWalk.REWRITE) != 0 ? 'r' : '-'); s.append((flags & RevWalk.UNINTERESTING) != 0 ? 'u' : '-'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java index 383428c85..f425e8761 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java @@ -125,11 +125,11 @@ public class RevWalk implements Iterable, AutoCloseable { /** * Temporary mark for use within {@link TopoSortGenerator}. *

- * This mark indicates the commit has been queued for emission in - * {@link TopoSortGenerator} and can be produced. This mark is removed when - * the commit has been produced. + * This mark indicates the commit could not produce when it wanted to, as at + * least one child was behind it. Commits with this flag are delayed until + * all children have been output first. */ - static final int TOPO_QUEUED = 1 << 5; + static final int TOPO_DELAY = 1 << 5; /** Number of flag bits we keep internal for our own use. See above flags. */ static final int RESERVED_FLAGS = 6; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java index 3c553b06c..7a5db43a7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java @@ -17,7 +17,7 @@ import org.eclipse.jgit.errors.MissingObjectException; /** Sorts commits in topological order. */ class TopoSortGenerator extends Generator { - private static final int TOPO_QUEUED = RevWalk.TOPO_QUEUED; + private static final int TOPO_DELAY = RevWalk.TOPO_DELAY; private final FIFORevQueue pending; @@ -47,16 +47,12 @@ class TopoSortGenerator extends Generator { if (c == null) { break; } - if ((c.flags & TOPO_QUEUED) == 0) { - for (RevCommit p : c.parents) { - p.inDegree++; - - if (firstParent) { - break; - } + for (RevCommit p : c.parents) { + p.inDegree++; + if (firstParent) { + break; } } - c.flags |= TOPO_QUEUED; pending.add(c); } } @@ -75,42 +71,34 @@ class TopoSortGenerator extends Generator { RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { - RevCommit c = pending.next(); - if (c == null) { + final RevCommit c = pending.next(); + if (c == null) return null; - } if (c.inDegree > 0) { // At least one of our children is missing. We delay // production until all of our children are output. // + c.flags |= TOPO_DELAY; continue; } - if ((c.flags & TOPO_QUEUED) == 0) { - // c is a parent that already produced or a parent that - // was never in the priority queue and should never produce. - // - continue; - } - + // All of our children have already produced, + // so it is OK for us to produce now as well. + // for (RevCommit p : c.parents) { - if (--p.inDegree == 0 && (p.flags & TOPO_QUEUED) != 0) { - // The parent has no unproduced interesting children. unpop - // the parent so it goes right behind this child. This means - // that this parent commit may appear in "pending" more than - // once, but this is safe since upon the second and - // subsequent iterations with this commit, it will no longer - // have TOPO_QUEUED set, and thus will be skipped. + if (--p.inDegree == 0 && (p.flags & TOPO_DELAY) != 0) { + // This parent tried to come before us, but we are + // his last child. unpop the parent so it goes right + // behind this child. // + p.flags &= ~TOPO_DELAY; pending.unpop(p); } if (firstParent) { break; } } - - c.flags &= ~TOPO_QUEUED; return c; } } From 7ba261fb5f516dce83adc6f3bd4ac1666a51193e Mon Sep 17 00:00:00 2001 From: Yunjie Li Date: Tue, 25 Feb 2020 17:29:38 -0800 Subject: [PATCH 03/16] ObjectWalk: Add null check before skip tree. currVisit could be null if a blob is marked as start point in ObjectWalk. Add null check before skipping current tree. Change-Id: Ic5d876fe2800f3373d136979be6c27d1bbd38dc1 Signed-off-by: Yunjie Li --- .../tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java | 8 ++++++++ .../src/org/eclipse/jgit/revwalk/ObjectWalk.java | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java index a3bfb71e4..da7b26612 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/ObjectWalkTest.java @@ -216,4 +216,12 @@ public class ObjectWalkTest extends RevWalkTestCase { assertSame(rw.lookupBlob(bId), objw.nextObject()); assertNull(objw.nextObject()); } + + @Test + public void testSkipTreeWhenStartFromBlob() throws Exception { + final RevBlob f1 = blob("1"); + objw.markStart(f1); + assertSame(f1, objw.nextObject()); + objw.skipTree(); + } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java index 21ce78e7e..04a4b4c63 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java @@ -364,7 +364,9 @@ public class ObjectWalk extends RevWalk { * @since 5.4 */ public void skipTree() { - currVisit.ptr = currVisit.buf.length; + if (currVisit != null) { + currVisit.ptr = currVisit.buf.length; + } } /** From 5a6b6eee35f07615f5d496781ee37f8ffe56b7d3 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 27 Feb 2020 20:27:31 +0900 Subject: [PATCH 04/16] Move array designators from the variable to the type As reported by Sonar Lint: Array designators should always be located on the type for better code readability. Otherwise, developers must look both at the type and the variable name to know whether or not a variable is an array. Change-Id: If6b41fed3483d0992d402d8680552ab4bef89ffb Signed-off-by: David Pursehouse --- .../src/org/eclipse/jgit/http/server/glue/RegexPipeline.java | 2 +- .../jgit/internal/transport/sshd/CachingKeyPairProvider.java | 2 +- .../jgit/internal/transport/sshd/proxy/HttpParser.java | 2 +- org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java | 2 +- .../eclipse/jgit/internal/storage/file/FileReftableStack.java | 4 ++-- .../org/eclipse/jgit/internal/storage/pack/PackWriter.java | 4 ++-- .../src/org/eclipse/jgit/merge/ResolveMerger.java | 2 +- .../src/org/eclipse/jgit/transport/UploadPack.java | 4 ++-- org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 2 +- org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java | 2 +- org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java index 010810508..06b31a547 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java @@ -138,7 +138,7 @@ class RegexPipeline extends UrlPipeline { // build a request for them so RegexGroupFilter can pick // a different capture group later. Continue using the // first capture group as the path info. - WrappedRequest groups[] = new WrappedRequest[cur.groupCount()]; + WrappedRequest[] groups = new WrappedRequest[cur.groupCount()]; for (int groupId = 1; groupId <= cur.groupCount(); groupId++) { final int s = cur.start(groupId); final String path, info; diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java index a1ec31883..9673ff0fb 100644 --- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java +++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/CachingKeyPairProvider.java @@ -121,7 +121,7 @@ public class CachingKeyPairProvider extends FileKeyPairProvider if (cache == null) { return loadKey(session, resource, path, getPasswordFinder()); } - Throwable t[] = { null }; + Throwable[] t = { null }; KeyPair key = cache.get(path, p -> { try { return loadKey(session, resource, p, getPasswordFinder()); diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java index 02771b501..af8bf4700 100644 --- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java +++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java @@ -249,7 +249,7 @@ public final class HttpParser { start = nextStart + 1; } else { if (header.charAt(nextStart) == '"') { - int nextEnd[] = { nextStart + 1 }; + int[] nextEnd = { nextStart + 1 }; String value = scanQuotedString(header, nextStart + 1, nextEnd); challenge.addArgument(header.substring(start, end), value); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java index 219da0e9b..4e79fc938 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java @@ -448,7 +448,7 @@ public class RawText extends Sequence { } } - byte data[]; + byte[] data; try { data = new byte[(int)sz]; } catch (OutOfMemoryError e) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java index 7abd1fb28..68d82c20d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableStack.java @@ -674,7 +674,7 @@ public class FileReftableStack implements AutoCloseable { } } - static List segmentSizes(long sizes[]) { + static List segmentSizes(long[] sizes) { List segments = new ArrayList<>(); Segment cur = new Segment(); for (int i = 0; i < sizes.length; i++) { @@ -694,7 +694,7 @@ public class FileReftableStack implements AutoCloseable { return segments; } - private static Optional autoCompactCandidate(long sizes[]) { + private static Optional autoCompactCandidate(long[] sizes) { if (sizes.length == 0) { return Optional.empty(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 11e6c803e..fcf9ca579 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -225,7 +225,7 @@ public class PackWriter implements AutoCloseable { } @SuppressWarnings("unchecked") - BlockList objectsLists[] = new BlockList[OBJ_TAG + 1]; + BlockList[] objectsLists = new BlockList[OBJ_TAG + 1]; { objectsLists[OBJ_COMMIT] = new BlockList<>(); objectsLists[OBJ_TREE] = new BlockList<>(); @@ -270,7 +270,7 @@ public class PackWriter implements AutoCloseable { private List sortedByName; - private byte packcsum[]; + private byte[] packcsum; private boolean deltaBaseAsOffset; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index e0b00c0bd..34b521e85 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -143,7 +143,7 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.0 */ - protected String commitNames[]; + protected String[] commitNames; /** * Index of the base tree within the {@link #tw tree walk}. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 8eac06388..8a88e175f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -2411,12 +2411,12 @@ public class UploadPack { } @Override - public void write(byte b[]) throws IOException { + public void write(byte[] b) throws IOException { out.write(b); } @Override - public void write(byte b[], int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { out.write(b, off, len); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index a2b53a253..265950261 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -2270,7 +2270,7 @@ public abstract class FS { void copy() throws IOException { boolean writeFailure = false; - byte buffer[] = new byte[4096]; + byte[] buffer = new byte[4096]; int readBytes; while ((readBytes = in.read(buffer)) != -1) { // Do not try to write again after a failure, but keep diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java index 85ee09501..0f6620e81 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java @@ -313,7 +313,7 @@ public class LfsFactory { } @Override - public int read(byte b[], int off, int len) throws IOException { + public int read(byte[] b, int off, int len) throws IOException { return stream.read(b, off, len); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java index cd2a8e672..500c23673 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Monitoring.java @@ -49,7 +49,7 @@ public class Monitoring { String metricName) { boolean register = false; try { - Class interfaces[] = mbean.getClass().getInterfaces(); + Class[] interfaces = mbean.getClass().getInterfaces(); for (Class i : interfaces) { register = SystemReader.getInstance().getUserConfig() .getBoolean( From 14a157dff66280944694ce27c1a5124a7f37e344 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 27 Feb 2020 20:32:29 +0900 Subject: [PATCH 05/16] Make Logger instances final Change-Id: Ibb997952917e47bc31a8cbe3863623bc959a8100 Signed-off-by: David Pursehouse --- .../src/org/eclipse/jgit/junit/RepeatRule.java | 2 +- .../src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java | 2 +- .../org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java | 2 +- .../org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java | 2 +- .../src/org/eclipse/jgit/dircache/DirCacheCheckout.java | 3 ++- org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java index 8636f2a0a..cc1d8d349 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java @@ -78,7 +78,7 @@ import org.junit.runners.model.Statement; */ public class RepeatRule implements TestRule { - private static Logger LOG = Logger + private static final Logger LOG = Logger .getLogger(RepeatRule.class.getName()); /** diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java index c7f55dd3c..e29783e92 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java @@ -93,7 +93,7 @@ import org.slf4j.LoggerFactory; * @since 4.3 */ public abstract class LfsProtocolServlet extends HttpServlet { - private static Logger LOG = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(LfsProtocolServlet.class); private static final long serialVersionUID = 1L; diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java index 06a772695..e65e60306 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java @@ -67,7 +67,7 @@ import org.eclipse.jgit.util.HttpSupport; */ public class ObjectDownloadListener implements WriteListener { - private static Logger LOG = Logger + private static final Logger LOG = Logger .getLogger(ObjectDownloadListener.class.getName()); private final AsyncContext context; diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java index 3bb2899b9..332e39f9d 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java @@ -71,7 +71,7 @@ import org.eclipse.jgit.lfs.lib.Constants; */ public class ObjectUploadListener implements ReadListener { - private static Logger LOG = Logger + private static final Logger LOG = Logger .getLogger(ObjectUploadListener.class.getName()); private final AsyncContext context; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index bbaed3766..3502d7a43 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -106,7 +106,8 @@ import org.slf4j.LoggerFactory; * This class handles checking out one or two trees merging with the index. */ public class DirCacheCheckout { - private static Logger LOG = LoggerFactory.getLogger(DirCacheCheckout.class); + private static final Logger LOG = LoggerFactory + .getLogger(DirCacheCheckout.class); private static final int MAX_EXCEPTION_TEXT_SIZE = 10 * 1024; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java index 1ad6602fc..e6971ee20 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java @@ -78,7 +78,7 @@ import org.slf4j.LoggerFactory; * @since 4.7 */ public class SHA1 { - private static Logger LOG = LoggerFactory.getLogger(SHA1.class); + private static final Logger LOG = LoggerFactory.getLogger(SHA1.class); private static final boolean DETECT_COLLISIONS; static { From 512ffc9e7f006677ddd7cc000a510121f93cb6bd Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Thu, 27 Feb 2020 11:05:23 +0100 Subject: [PATCH 06/16] Using for-each loop in jdt Running the JDT cleanup action for using a for-each loop on jgit Change-Id: Ie724d8bbdff786ab0167089e90a9914a8135103c Signed-off-by: Lars Vogel --- org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java | 3 +-- .../src/org/eclipse/jgit/fnmatch/FileNameMatcher.java | 4 ++-- .../org/eclipse/jgit/internal/storage/pack/DeltaIndex.java | 4 ++-- .../eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java | 4 ++-- .../src/org/eclipse/jgit/transport/HttpAuthMethod.java | 3 +-- org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java | 4 ++-- org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java | 4 ++-- org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java | 4 ++-- 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index b722fbe9d..6678af163 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -338,8 +338,7 @@ public class RebaseCommand extends GitCommand { steps, false); } checkSteps(steps); - for (int i = 0; i < steps.size(); i++) { - RebaseTodoLine step = steps.get(i); + for (RebaseTodoLine step : steps) { popSteps(1); RebaseResult result = processStep(step, true); if (result != null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java index 3a6c413a0..57b90e966 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java @@ -380,8 +380,8 @@ public class FileNameMatcher { * @return a boolean. */ public boolean canAppendMatch() { - for (int i = 0; i < heads.size(); i++) { - if (heads.get(i) != LastHead.INSTANCE) { + for (Head head : heads) { + if (head != LastHead.INSTANCE) { return true; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java index 79eaea093..7ed5defbe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaIndex.java @@ -122,8 +122,8 @@ public class DeltaIndex { // logic linear in the size of the input rather than quadratic. // int cnt = 0; - for (int i = 0; i < table.length; i++) { - int h = table[i]; + for (int element : table) { + int h = element; if (h == 0) continue; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java index 0d782e0a3..efb5ee5e4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java @@ -42,8 +42,8 @@ public abstract class PatternMatchRevFilter extends RevFilter { protected static final String forceToRaw(String patternText) { final byte[] b = Constants.encode(patternText); final StringBuilder needle = new StringBuilder(b.length); - for (int i = 0; i < b.length; i++) - needle.append((char) (b[i] & 0xff)); + for (byte element : b) + needle.append((char) (element & 0xff)); return needle.toString(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java index adc85a18e..aec5b89c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java @@ -423,8 +423,7 @@ abstract class HttpAuthMethod { private static String LHEX(byte[] bin) { StringBuilder r = new StringBuilder(bin.length * 2); - for (int i = 0; i < bin.length; i++) { - byte b = bin[i]; + for (byte b : bin) { r.append(LHEX[(b >>> 4) & 0x0f]); r.append(LHEX[b & 0x0f]); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java index 858d1f7b6..06520ec4c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java @@ -303,8 +303,8 @@ public class URIish implements Serializable { return null; ByteArrayOutputStream os = new ByteArrayOutputStream(s.length()); byte[] bytes = s.getBytes(UTF_8); - for (int i = 0; i < bytes.length; ++i) { - int b = bytes[i] & 0xFF; + for (byte c : bytes) { + int b = c & 0xFF; if (b <= 32 || (encodeNonAscii && b > 127) || b == '%' || (escapeReservedChars && reservedChars.get(b))) { os.write('%'); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java index c45f0095d..493ca312d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/QuotedString.java @@ -243,8 +243,8 @@ public abstract class QuotedString { final byte[] out = new byte[4 * in.length + 2]; int o = 0; out[o++] = '"'; - for (int i = 0; i < in.length; i++) { - final int c = in[i] & 0xff; + for (byte element : in) { + final int c = element & 0xff; if (c < quote.length) { final byte style = quote[c]; if (style == 0) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java index 669f73842..df9c6c78f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java @@ -559,8 +559,8 @@ public final class RawParseUtils { } while (ptr < b.length - (headerName.length + 1)) { boolean found = true; - for (int i = 0; i < headerName.length; i++) { - if (headerName[i] != b[ptr++]) { + for (byte element : headerName) { + if (element != b[ptr++]) { found = false; break; } From c2066bd071ee86c90465851627764362f71ad00a Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Fri, 28 Feb 2020 00:32:50 +0100 Subject: [PATCH 07/16] [releng] Update year in copyright notices for features Bump upper end of range to 2020. These copyright notices are user-facing; they're visible in several dialogs in Eclipse. It is strange or even misleading to see a copyright notice for JGit saying "2005, 2010" when there have been *many* developments in the past ten years. Change-Id: Idaa6244b2b3d9cecb29cc690085f8d008195cf12 Signed-off-by: Thomas Wolf --- .../org.eclipse.jgit.feature/feature.properties | 2 +- .../org.eclipse.jgit.http.apache.feature/feature.properties | 2 +- .../org.eclipse.jgit.junit.feature/feature.properties | 2 +- .../org.eclipse.jgit.lfs.feature/feature.properties | 2 +- .../org.eclipse.jgit.pgm.feature/feature.properties | 2 +- .../org.eclipse.jgit.source.feature/feature.properties | 2 +- .../org.eclipse.jgit.ssh.apache.feature/feature.properties | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties index d47cc013d..848365e17 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties @@ -20,7 +20,7 @@ A pure Java implementation of the Git version control system.\n # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2005, 2010 Shawn Pearce, Robin Rosenberg, et.al.\n\ +Copyright (c) 2005, 2020 Shawn Pearce, Robin Rosenberg, et.al.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Distribution License v1.0\n\ which accompanies this distribution, and is available at\n\ diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties index b2fd6ed5c..782d5bf61 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties @@ -20,7 +20,7 @@ Optional Http support using Apache httpclient.\n # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2005, 2013 Shawn Pearce, Robin Rosenberg, et.al.\n\ +Copyright (c) 2005, 2020 Shawn Pearce, Robin Rosenberg, et.al.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Distribution License v1.0\n\ which accompanies this distribution, and is available at\n\ diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties index acf33a9ce..fb1de80e2 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties @@ -20,7 +20,7 @@ description=JUnit test support for JGit # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2010, Matthias Sohn \n\ +Copyright (c) 2010, 2020 Matthias Sohn \n\ and other copyright owners as documented in the project's IP log.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Distribution License v1.0\n\ diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties index 5d953fa4c..858ba9395 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties @@ -20,7 +20,7 @@ Optional LFS support.\n # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2015, Matthias Sohn et.al.\n\ +Copyright (c) 2015, 2020 Matthias Sohn et.al.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Distribution License v1.0\n\ which accompanies this distribution, and is available at\n\ diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties index 450cff4a0..6c1405db2 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties @@ -20,7 +20,7 @@ Command line interface for a pure Java implementation of the Git version control # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2005-2012 Shawn Pearce, Robin Rosenberg, et.al.\n\ +Copyright (c) 2005, 2020 Shawn Pearce, Robin Rosenberg, et.al.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Distribution License v1.0\n\ which accompanies this distribution, and is available at\n\ diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties index 5043c3234..b8e0417f5 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties @@ -21,7 +21,7 @@ Source code for the support for PDE's JUnit runner for a Target Platform\n # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2005, 2010 Shawn Pearce, Robin Rosenberg, et.al.\n\ +Copyright (c) 2005, 2020 Shawn Pearce, Robin Rosenberg, et.al.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Distribution License v1.0\n\ which accompanies this distribution, and is available at\n\ diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties index e412fc217..8c389439d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties @@ -20,7 +20,7 @@ Ssh support using Apache MINA sshd.\n # "copyright" property - text of the "Feature Update Copyright" copyright=\ -Copyright (c) 2018 Thomas Wolf and others.\n\ +Copyright (c) 2018, 2020 Thomas Wolf and others.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Distribution License v1.0\n\ which accompanies this distribution, and is available at\n\ From 6f268f8cebbc53a9810f0fe6ca1a961a32d8b074 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Thu, 27 Feb 2020 20:04:47 +0100 Subject: [PATCH 08/16] Cygwin expects forward slashes for commands to be run via sh.exe FS_Win32_Cygwin replaces backslashes by / as a side-effect of relativize(). When support for core.hooksPath was added, paths were relativized in a different place using Path.resolve(), which doesn't do that transformation. As a result hooks could not be run on Cygwin in some cases. Do the transformation in FS_Win32_Cygwin.runInShell(). In all other places, File or Path objects are used, which give no guarantee about the file separator (typically the system-dependent default separator), so doing the transformation earlier still wouldn't guarantee that sh.exe indeed gets a command string using forward slashes. Bug: 558577 Change-Id: I3c07eb85f0ac7c5628a2e92f990e5cdb7ecf532f Signed-off-by: Thomas Wolf --- org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java index 10be26f79..41c239f1a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java @@ -150,7 +150,7 @@ public class FS_Win32_Cygwin extends FS_Win32 { argv.add("sh.exe"); //$NON-NLS-1$ argv.add("-c"); //$NON-NLS-1$ argv.add("$0 \"$@\""); //$NON-NLS-1$ - argv.add(cmd); + argv.add(cmd.replace(File.separatorChar, '/')); argv.addAll(Arrays.asList(args)); ProcessBuilder proc = new ProcessBuilder(); proc.command(argv); From 8f961240f11340009ab86914e67cd2104c46f28d Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sat, 29 Feb 2020 00:07:39 +0100 Subject: [PATCH 09/16] Update Orbit to S20200224183213 for 2020-03 RC1 Change-Id: Ic37b1b8dc62de0bb30fa50562bed428f49d404bc Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.target/jgit-4.10.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.11.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.12.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.13.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.14-staging.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.6.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.7.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.8.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.9.target | 4 ++-- .../org.eclipse.jgit.target/orbit/staging-2020-03.tpd | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index 1c6c95ce0..14ee36c8c 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index e97b2553f..55270c83e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index 4dff43fee..81cf190b9 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index a03d04cc5..5aa16573b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target index ca47ea91e..5b5604321 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index 4747817f7..840e09378 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index 46fead68a..db50b3ec1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index d400753c4..c3aae7b16 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index 8c5e9cebc..f2a1e156a 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd index d010e5fca..9de995717 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd @@ -1,7 +1,7 @@ target "staging-2020-03" with source configurePhase // see http://download.eclipse.org/tools/orbit/downloads/ -location "https://download.eclipse.org/tools/orbit/downloads/drops/S20200219023850/repository" { +location "https://download.eclipse.org/tools/orbit/downloads/drops/S20200224183213/repository" { com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902] From e9852c1597ec9aa276b9047d8ac025e120a477d4 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 2 Mar 2020 22:07:14 +0100 Subject: [PATCH 10/16] Update Orbit to R20200224183213 for final 2020-03 Change-Id: I00eb77ec4c055de0e5900a2c4ed82770e2031dab Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.target/jgit-4.10.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.10.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.11.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.11.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.12.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.12.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.13.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.13.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.14-staging.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.14-staging.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.6.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.6.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.7.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.7.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.8.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.8.tpd | 2 +- .../org.eclipse.jgit.target/jgit-4.9.target | 4 ++-- .../org.eclipse.jgit.target/jgit-4.9.tpd | 2 +- .../{staging-2020-03.tpd => R20200224183213-2020-03.tpd} | 4 ++-- 19 files changed, 29 insertions(+), 29 deletions(-) rename org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/{staging-2020-03.tpd => R20200224183213-2020-03.tpd} (97%) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index 14ee36c8c..c5a8b09eb 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd index fc18203cb..ed3cd211d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd @@ -1,7 +1,7 @@ target "jgit-4.10" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/2018-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index 55270c83e..ac0c33de1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd index dd1f6245b..426b61ea1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd @@ -1,7 +1,7 @@ target "jgit-4.11" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/2019-03/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index 81cf190b9..39d011cc1 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd index bf32ed904..8a8c0df1c 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd @@ -1,7 +1,7 @@ target "jgit-4.12" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/2019-06/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index 5aa16573b..f875b54ea 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd index e46a5dfe4..a58e21559 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd @@ -1,7 +1,7 @@ target "jgit-4.13" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/2019-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target index 5b5604321..ea5a2adf6 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd index d1f0d49cc..ae1b08961 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd @@ -1,7 +1,7 @@ target "jgit-4.14-staging" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/staging/2019-12/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index 840e09378..8cdce9372 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd index eb3f96d3b..5e169d8c6 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd @@ -1,7 +1,7 @@ target "jgit-4.6" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/neon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index db50b3ec1..bd287080d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd index cb98e4c87..c87530276 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd @@ -1,7 +1,7 @@ target "jgit-4.7" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/oxygen/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index c3aae7b16..cd15ba60f 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd index e0d886adf..91ab59716 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd @@ -1,7 +1,7 @@ target "jgit-4.8" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/photon/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index f2a1e156a..f71923f1d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -84,7 +84,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd index 32321d874..faa6fba18 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd @@ -1,7 +1,7 @@ target "jgit-4.9" with source configurePhase include "projects/jetty-9.4.x.tpd" -include "orbit/staging-2020-03.tpd" +include "orbit/R20200224183213-2020-03.tpd" location "http://download.eclipse.org/releases/2018-09/" { org.eclipse.osgi lazy diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20200224183213-2020-03.tpd similarity index 97% rename from org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd rename to org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20200224183213-2020-03.tpd index 9de995717..796afa082 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/staging-2020-03.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20200224183213-2020-03.tpd @@ -1,7 +1,7 @@ -target "staging-2020-03" with source configurePhase +target "R20200224183213-2020-03" with source configurePhase // see http://download.eclipse.org/tools/orbit/downloads/ -location "https://download.eclipse.org/tools/orbit/downloads/drops/S20200224183213/repository" { +location "https://download.eclipse.org/tools/orbit/downloads/drops/R20200224183213/repository" { com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110] com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902] From 95fd662dd3f5a0808cacc8066a0f43f15684301d Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Mon, 2 Mar 2020 22:29:03 +0100 Subject: [PATCH 11/16] Add 4.14 and 4.15-staging target platforms - copy old 4.14-staging to 4.14 target platform - create 4.15-staging target platform from former 4.14-staging Change-Id: I874f552205f1bc419334e4f66ebfef4cbc8cb4ff Signed-off-by: Matthias Sohn --- .../org.eclipse.jgit.target/jgit-4.14.target | 94 +++++++++++++++++++ .../org.eclipse.jgit.target/jgit-4.14.tpd | 8 ++ ...taging.target => jgit-4.15-staging.target} | 4 +- ...4.14-staging.tpd => jgit-4.15-staging.tpd} | 2 +- 4 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target create mode 100644 org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.tpd rename org.eclipse.jgit.packaging/org.eclipse.jgit.target/{jgit-4.14-staging.target => jgit-4.15-staging.target} (98%) rename org.eclipse.jgit.packaging/org.eclipse.jgit.target/{jgit-4.14-staging.tpd => jgit-4.15-staging.tpd} (73%) diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target new file mode 100644 index 000000000..d601082ff --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.tpd new file mode 100644 index 000000000..a9ef71d17 --- /dev/null +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.tpd @@ -0,0 +1,8 @@ +target "jgit-4.14-staging" with source configurePhase + +include "projects/jetty-9.4.x.tpd" +include "orbit/R20200224183213-2020-03.tpd" + +location "http://download.eclipse.org/releases/2019-12/201912181000/" { + org.eclipse.osgi lazy +} diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15-staging.target similarity index 98% rename from org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target rename to org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15-staging.target index ea5a2adf6..ab8e6ec15 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15-staging.target @@ -1,7 +1,7 @@ - + @@ -88,7 +88,7 @@ - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15-staging.tpd similarity index 73% rename from org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd rename to org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15-staging.tpd index ae1b08961..1bfb3752b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15-staging.tpd @@ -3,6 +3,6 @@ target "jgit-4.14-staging" with source configurePhase include "projects/jetty-9.4.x.tpd" include "orbit/R20200224183213-2020-03.tpd" -location "http://download.eclipse.org/staging/2019-12/" { +location "http://download.eclipse.org/staging/2020-03/" { org.eclipse.osgi lazy } From 30fb4808f2407cbea6c8cf46189033b0231aa423 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 18 Feb 2020 20:44:10 +0100 Subject: [PATCH 12/16] Update reftable storage repo layout The change Ic0b974fa (c217d33, "Documentation/technical/reftable: improve repo layout") defines a new repository layout, which was agreed with the git-core mailing list. It addresses the following problems: * old git clients will not recognize reftable-based repositories, and look at encompassing directories. * Poorly written tools might write directly into .git/refs/heads/BRANCH. Since we consider JGit reftable as experimental (git-core doesn't support it yet), we have no backward compatibility. If you created a repository with reftable between mid-Nov 2019 and now, you can do the following to convert: mv .git/refs .git/reftable/tables.list git config core.repositoryformatversion 1 git config extensions.refStorage reftable Change-Id: I80df35b9d22a8ab893dcbe9fbd051d924788d6a5 Signed-off-by: Han-Wen Nienhuys Signed-off-by: Matthias Sohn --- .../storage/file/FileReftableTest.java | 42 +++++-- org.eclipse.jgit/.settings/.api_filters | 24 ++++ .../storage/file/FileReftableDatabase.java | 25 ++-- .../internal/storage/file/FileRepository.java | 116 +++++++++++++----- .../org/eclipse/jgit/lib/ConfigConstants.java | 21 ++++ .../src/org/eclipse/jgit/lib/Constants.java | 6 + 6 files changed, 182 insertions(+), 52 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java index bca113fbf..2ffbc6255 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileReftableTest.java @@ -124,11 +124,6 @@ public class FileReftableTest extends SampleDataRepositoryTestCase { } } - @Test - public void additionalRefsAreRemoved() { - assertFalse(new File(db.getDirectory(), Constants.HEAD).exists()); - } - @Test public void testCompactFully() throws Exception { ObjectId c1 = db.resolve("master^^"); @@ -141,9 +136,16 @@ public class FileReftableTest extends SampleDataRepositoryTestCase { } File tableDir = new File(db.getDirectory(), Constants.REFTABLE); - assertTrue(tableDir.listFiles().length > 1); + assertTrue(tableDir.listFiles().length > 2); ((FileReftableDatabase)db.getRefDatabase()).compactFully(); - assertEquals(tableDir.listFiles().length,1); + assertEquals(tableDir.listFiles().length,2); + } + + @Test + public void testOpenConvert() throws Exception { + try (FileRepository repo = new FileRepository(db.getDirectory())) { + assertTrue(repo.getRefDatabase() instanceof FileReftableDatabase); + } } @Test @@ -162,7 +164,7 @@ public class FileReftableTest extends SampleDataRepositoryTestCase { @Test public void testConvertToRefdir() throws Exception { - db.convertToPackedRefs(false); + db.convertToPackedRefs(false, false); assertTrue(db.getRefDatabase() instanceof RefDirectory); Ref h = db.exactRef("HEAD"); assertTrue(h.isSymbolic()); @@ -176,6 +178,30 @@ public class FileReftableTest extends SampleDataRepositoryTestCase { assertFalse(db.getRefDatabase().hasFastTipsWithSha1()); } + @Test + public void testConvertToRefdirReflog() throws Exception { + Ref a = db.exactRef("refs/heads/a"); + String aCommit = a.getObjectId().getName(); + RefUpdate u = db.updateRef("refs/heads/master"); + u.setForceUpdate(true); + u.setNewObjectId(ObjectId.fromString(aCommit)); + u.setForceRefLog(true); + u.setRefLogMessage("apple", false); + u.update(); + + RefUpdate v = db.updateRef("refs/heads/master"); + v.setForceUpdate(true); + v.setNewObjectId(ObjectId.fromString(bCommit)); + v.setForceRefLog(true); + v.setRefLogMessage("banana", false); + v.update(); + + db.convertToPackedRefs(true, false); + List logs = db.getReflogReader("refs/heads/master").getReverseEntries(2); + assertEquals(logs.get(0).getComment(), "banana"); + assertEquals(logs.get(1).getComment(), "apple"); + } + @Test public void testBatchrefUpdate() throws Exception { ObjectId cur = db.resolve("master"); diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters index f3c9b99d1..5fc26a553 100644 --- a/org.eclipse.jgit/.settings/.api_filters +++ b/org.eclipse.jgit/.settings/.api_filters @@ -53,6 +53,24 @@ + + + + + + + + + + + + + + + + + + @@ -61,6 +79,12 @@ + + + + + + diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java index c9ee165a3..c0dc625d9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileReftableDatabase.java @@ -97,6 +97,11 @@ public class FileReftableDatabase extends RefDatabase { private final FileReftableStack reftableStack; + FileReftableDatabase(FileRepository repo) throws IOException { + this(repo, new File(new File(repo.getDirectory(), Constants.REFTABLE), + Constants.TABLES_LIST)); + } + FileReftableDatabase(FileRepository repo, File refstackName) throws IOException { this.fileRepository = repo; this.reftableStack = new FileReftableStack(refstackName, @@ -121,8 +126,7 @@ public class FileReftableDatabase extends RefDatabase { * @return whether the given repo uses reftable for refdb storage. */ public static boolean isReftable(File repoDir) { - return new File(repoDir, "refs").isFile() //$NON-NLS-1$ - && new File(repoDir, Constants.REFTABLE).isDirectory(); + return new File(repoDir, Constants.REFTABLE).isDirectory(); } /** {@inheritDoc} */ @@ -626,8 +630,6 @@ public class FileReftableDatabase extends RefDatabase { /** * @param repo * the repository - * @param refstackName - * the filename for the stack * @param writeLogs * whether to write reflogs * @return a reftable based RefDB from an existing repository. @@ -635,22 +637,25 @@ public class FileReftableDatabase extends RefDatabase { * on IO error */ public static FileReftableDatabase convertFrom(FileRepository repo, - File refstackName, boolean writeLogs) throws IOException { + boolean writeLogs) throws IOException { FileReftableDatabase newDb = null; + File reftableList = null; try { - File reftableDir = new File(repo.getDirectory(), Constants.REFTABLE); + File reftableDir = new File(repo.getDirectory(), + Constants.REFTABLE); + reftableList = new File(reftableDir, Constants.TABLES_LIST); if (!reftableDir.isDirectory()) { reftableDir.mkdir(); } - try (FileReftableStack stack = new FileReftableStack(refstackName, + try (FileReftableStack stack = new FileReftableStack(reftableList, reftableDir, null, () -> repo.getConfig())) { stack.addReftable(rw -> writeConvertTable(repo, rw, writeLogs)); } - refstackName = null; + reftableList = null; } finally { - if (refstackName != null) { - refstackName.delete(); + if (reftableList != null) { + reftableList.delete(); } } return newDb; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java index 2f6ef5113..9929c46af 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java @@ -51,10 +51,13 @@ import static java.util.stream.Collectors.toList; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStream; import java.text.MessageFormat; import java.text.ParseException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -83,6 +86,7 @@ import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RefDatabase; import org.eclipse.jgit.lib.RefUpdate; +import org.eclipse.jgit.lib.ReflogEntry; import org.eclipse.jgit.lib.ReflogReader; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.StoredConfig; @@ -205,18 +209,17 @@ public class FileRepository extends Repository { ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 0); String reftype = repoConfig.getString( - "extensions", null, "refStorage"); //$NON-NLS-1$ //$NON-NLS-2$ + ConfigConstants.CONFIG_EXTENSIONS_SECTION, null, + ConfigConstants.CONFIG_KEY_REF_STORAGE); if (repositoryFormatVersion >= 1 && reftype != null) { - if (StringUtils.equalsIgnoreCase(reftype, "reftable")) { //$NON-NLS-1$ - refs = new FileReftableDatabase(this, - new File(getDirectory(), "refs")); //$NON-NLS-1$ + if (StringUtils.equalsIgnoreCase(reftype, + ConfigConstants.CONFIG_REF_STORAGE_REFTABLE)) { + refs = new FileReftableDatabase(this); } else if (StringUtils.equalsIgnoreCase(reftype, "reftree")) { //$NON-NLS-1$ refs = new RefTreeDatabase(this, new RefDirectory(this)); } else { throw new IOException(JGitText.get().unknownRepositoryFormat); } - } else if (FileReftableDatabase.isReftable(getDirectory())) { - refs = new FileReftableDatabase(this, new File(getDirectory(), "refs")); //$NON-NLS-1$ } else { refs = new RefDirectory(this); } @@ -640,15 +643,18 @@ public class FileRepository extends Repository { * Converts the RefDatabase from reftable to RefDirectory. This operation is * not atomic. * + * @param writeLogs + * whether to write reflogs * @param backup * whether to rename or delete the old storage files. If set to - * true, the reftable list is left in "refs.old", and the - * reftable/ dir is left alone. If set to false, the reftable/ - * dir is removed, and "refs" file is removed. + * {@code true}, the reftable list is left in {@code refs.old}, + * and the {@code reftable/} dir is left alone. If set to + * {@code false}, the {@code reftable/} dir is removed, and + * {@code refs} file is removed. * @throws IOException * on IO problem */ - void convertToPackedRefs(boolean backup) throws IOException { + void convertToPackedRefs(boolean writeLogs, boolean backup) throws IOException { List all = refs.getRefs(); File packedRefs = new File(getDirectory(), Constants.PACKED_REFS); if (packedRefs.exists()) { @@ -657,26 +663,26 @@ public class FileRepository extends Repository { } File refsFile = new File(getDirectory(), "refs"); //$NON-NLS-1$ - - refs.close(); - - if (backup) { - File refsOld = new File(getDirectory(), "refs.old"); //$NON-NLS-1$ - if (refsOld.exists()) { - throw new IOException(MessageFormat.format( - JGitText.get().fileAlreadyExists, - "refs.old")); //$NON-NLS-1$ - } - FileUtils.rename(refsFile, refsOld); - } else { - refsFile.delete(); - } + File refsHeadsFile = new File(refsFile, "heads");//$NON-NLS-1$ + File headFile = new File(getDirectory(), Constants.HEAD); + FileReftableDatabase oldDb = (FileReftableDatabase) refs; + + // Remove the dummy files that ensure compatibility with older git + // versions (see convertToReftable). First make room for refs/heads/ + refsHeadsFile.delete(); + // RefDirectory wants to create the refs/ directory from scratch, so + // remove that too. + refsFile.delete(); + // remove HEAD so its previous invalid value doesn't cause issues. + headFile.delete(); // This is not atomic, but there is no way to instantiate a RefDirectory // that is disconnected from the current repo. - refs = new RefDirectory(this); + RefDirectory refDir = new RefDirectory(this); + refs = refDir; refs.create(); + ReflogWriter logWriter = refDir.newLogWriter(true); List symrefs = new ArrayList<>(); BatchRefUpdate bru = refs.newBatchUpdate(); for (Ref r : all) { @@ -686,6 +692,15 @@ public class FileRepository extends Repository { bru.addCommand(new ReceiveCommand(ObjectId.zeroId(), r.getObjectId(), r.getName())); } + + if (writeLogs) { + List logs = oldDb.getReflogReader(r.getName()) + .getReverseEntries(); + Collections.reverse(logs); + for (ReflogEntry e : logs) { + logWriter.log(r.getName(), e); + } + } } try (RevWalk rw = new RevWalk(this)) { @@ -721,20 +736,38 @@ public class FileRepository extends Repository { FileUtils.delete(reftableDir, FileUtils.RECURSIVE | FileUtils.IGNORE_ERRORS); } + repoConfig.unset(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null, + ConfigConstants.CONFIG_KEY_REF_STORAGE); } + /** + * Converts the RefDatabase from RefDirectory to reftable. This operation is + * not atomic. + * + * @param writeLogs + * whether to write reflogs + * @param backup + * whether to rename or delete the old storage files. If set to + * {@code true}, the loose refs are left in {@code refs.old}, the + * packed-refs in {@code packed-refs.old} and reflogs in + * {@code refs.old/}. HEAD is left in {@code HEAD.old} and also + * {@code .log} is appended to additional refs. If set to + * {@code false}, the {@code refs/} and {@code logs/} directories + * and {@code HEAD} and additional symbolic refs are removed. + * @throws IOException + * on IO problem + */ @SuppressWarnings("nls") void convertToReftable(boolean writeLogs, boolean backup) throws IOException { - File newRefs = new File(getDirectory(), "refs.new"); File reftableDir = new File(getDirectory(), Constants.REFTABLE); - + File headFile = new File(getDirectory(), Constants.HEAD); if (reftableDir.exists() && reftableDir.listFiles().length > 0) { throw new IOException(JGitText.get().reftableDirExists); } // Ignore return value, as it is tied to temporary newRefs file. - FileReftableDatabase.convertFrom(this, newRefs, writeLogs); + FileReftableDatabase.convertFrom(this, writeLogs); File refsFile = new File(getDirectory(), "refs"); @@ -742,7 +775,6 @@ public class FileRepository extends Repository { File packedRefs = new File(getDirectory(), Constants.PACKED_REFS); File logsDir = new File(getDirectory(), Constants.LOGS); - List additional = getRefDatabase().getAdditionalRefs().stream() .map(Ref::getName).collect(toList()); additional.add(Constants.HEAD); @@ -761,7 +793,8 @@ public class FileRepository extends Repository { new File(getDirectory(), r + ".old")); } } else { - packedRefs.delete(); // ignore return value. + FileUtils.delete(packedRefs, FileUtils.SKIP_MISSING); + FileUtils.delete(headFile); FileUtils.delete(logsDir, FileUtils.RECURSIVE); FileUtils.delete(refsFile, FileUtils.RECURSIVE); for (String r : additional) { @@ -769,11 +802,26 @@ public class FileRepository extends Repository { } } - // Put new data. - FileUtils.rename(newRefs, refsFile); + FileUtils.mkdir(refsFile, true); + + // By putting in a dummy HEAD, old versions of Git still detect a repo + // (that they can't read) + try (OutputStream os = new FileOutputStream(headFile)) { + os.write(Constants.encodeASCII("ref: refs/heads/.invalid")); + } + + // Some tools might write directly into .git/refs/heads/BRANCH. By + // putting a file here, this fails spectacularly. + FileUtils.createNewFile(new File(refsFile, "heads")); + repoConfig.setString(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null, + ConfigConstants.CONFIG_KEY_REF_STORAGE, + ConfigConstants.CONFIG_REF_STORAGE_REFTABLE); + repoConfig.setLong(ConfigConstants.CONFIG_CORE_SECTION, null, + ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 1); + repoConfig.save(); refs.close(); - refs = new FileReftableDatabase(this, refsFile); + refs = new FileReftableDatabase(this); } /** @@ -797,7 +845,7 @@ public class FileRepository extends Repository { } } else if (format.equals("refdir")) {//$NON-NLS-1$ if (refs instanceof FileReftableDatabase) { - convertToPackedRefs(backup); + convertToPackedRefs(writeLogs, backup); } } else { throw new IOException(String.format( diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java index 695903d04..99512a6a4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java @@ -443,6 +443,12 @@ public final class ConfigConstants { */ public static final String CONFIG_RENAMELIMIT_COPIES = "copies"; + /** + * A "refStorage" value in the "extensions". + * @since 5.6.2 + */ + public static final String CONFIG_REF_STORAGE_REFTABLE = "reftable"; + /** * The "renames" key in the "diff" section * @since 3.0 @@ -538,9 +544,24 @@ public final class ConfigConstants { */ public static final String CONFIG_KEY_MIN_RACY_THRESHOLD = "minRacyThreshold"; + + /** + * The "refStorage" key + * + * @since 5.6.2 + */ + public static final String CONFIG_KEY_REF_STORAGE = "refStorage"; + /** * The "jmx" section * @since 5.1.13 */ public static final String CONFIG_JMX_SECTION = "jmx"; + + /** + * The "extensions" section + * + * @since 5.6.2 + */ + public static final String CONFIG_EXTENSIONS_SECTION = "extensions"; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index abd9dd6d3..3c05cab86 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -287,6 +287,12 @@ public final class Constants { */ public static final String REFTABLE = "reftable"; + /** + * Reftable table list name. + * @since 5.6.2 + */ + public static final String TABLES_LIST = "tables.list"; + /** Info refs folder */ public static final String INFO_REFS = "info/refs"; From 093fbbd11e01711efc1567d6c31516a448d2a455 Mon Sep 17 00:00:00 2001 From: Alex Blewitt Date: Tue, 25 Feb 2020 21:14:59 +0000 Subject: [PATCH 13/16] Expose FileStoreAttributes.setBackground() The FS.setAsyncFileStoreAttributes() static method calls FileStoreAttributes.setBackground() as its implementation, but there are other public attributes on this inner class already and there isn't a real reason why this needs to be private. By making it public we allow callers to be able to invoke it directly. Although it doesn't appear that it would make a difference, by calling a static method on the FS class, all static fields and the transitive closure of class dependencies must be loaded and initialised, which can be non-trivial. Callers referring to FS.setAsyncFileStoreAttributes() may be replaced with FS.FileStoreAttributes.setBackground() with no change of behaviour other than improved performance due to less class loading required. Bug: 560527 Change-Id: I9538acc90da8d18f53fd60d74eb54496857f93a5 Signed-off-by: Alex Blewitt --- org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 265950261..2446de4c1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -242,7 +242,16 @@ public abstract class FS { private static Map locks = new ConcurrentHashMap<>(); - private static void setBackground(boolean async) { + /** + * Whether FileStore attributes should be determined asynchronously + * + * @param async + * whether FileStore attributes should be determined + * asynchronously. If false access to cached attributes may block + * for some seconds for the first call per FileStore + * @since 5.6.2 + */ + public static void setBackground(boolean async) { background.set(async); } @@ -709,7 +718,9 @@ public abstract class FS { * asynchronously. If false access to cached attributes may block * for some seconds for the first call per FileStore * @since 5.1.9 + * @deprecated Use {@link FileStoreAttributes#setBackground} instead */ + @Deprecated public static void setAsyncFileStoreAttributes(boolean asynch) { FileStoreAttributes.setBackground(asynch); } From d7f304045af2f602c5b0c1a26d2c7f643753cf8f Mon Sep 17 00:00:00 2001 From: Michael Dardis Date: Wed, 4 Mar 2020 15:25:09 +1100 Subject: [PATCH 14/16] Add validation to hex decoder Does not fix any issue but prevents user from shooting themselves in the foot with improper configuration. Suggested by Demetr Starshov at https://git.eclipse.org/r/#/c/157681/ Change-Id: I006d65022f0a7d4066970825d00080c59404fdc3 Signed-off-by: Michael Dardis Signed-off-by: Matthias Sohn --- .../tst/org/eclipse/jgit/util/HexTest.java | 25 +++++++++++++++++++ .../eclipse/jgit/internal/JGitText.properties | 1 + .../org/eclipse/jgit/internal/JGitText.java | 1 + .../src/org/eclipse/jgit/util/Hex.java | 21 +++++++++++++--- 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HexTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HexTest.java index 32af07f25..5f3ab0b77 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HexTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HexTest.java @@ -42,6 +42,31 @@ public class HexTest { } } + @Test(expected = IllegalArgumentException.class) + public void testIllegal() { + decode("0011test00"); + } + + @Test(expected = IllegalArgumentException.class) + public void testIllegal2() { + decode("0123456789abcdefgh"); + } + + @Test(expected = IllegalArgumentException.class) + public void testIllegal3() { + decode("0123456789abcdef-_+*"); + } + + @Test + public void testLegal() { + decode("0123456789abcdef"); + } + + @Test + public void testLegal2() { + decode("deadbeef"); + } + private static byte[] b(String str) { return Constants.encode(str); } diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index 153399ca3..1218ee612 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -354,6 +354,7 @@ invalidFilter=Invalid filter: {0} invalidGitdirRef = Invalid .git reference in file ''{0}'' invalidGitModules=Invalid .gitmodules file invalidGitType=invalid git type: {0} +invalidHexString=Invalid hex string: {0} invalidHooksPath=Invalid git config core.hooksPath = {0} invalidId=Invalid id: {0} invalidId0=Invalid id diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index ef4c85594..6235dd83d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -382,6 +382,7 @@ public class JGitText extends TranslationBundle { /***/ public String invalidGitdirRef; /***/ public String invalidGitModules; /***/ public String invalidGitType; + /***/ public String invalidHexString; /***/ public String invalidHooksPath; /***/ public String invalidId; /***/ public String invalidId0; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java index 935903652..925159830 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Hex.java @@ -10,6 +10,10 @@ package org.eclipse.jgit.util; +import java.text.MessageFormat; + +import org.eclipse.jgit.internal.JGitText; + /** * Encodes and decodes to and from hexadecimal notation. * @@ -27,9 +31,11 @@ public final class Hex { /** * Decode a hexadecimal string to a byte array. * - * Note this method performs no validation on input content. + * Note this method validates that characters in the given string are valid + * as digits in a hex string. * - * @param s hexadecimal string + * @param s + * hexadecimal string * @return decoded array */ public static byte[] decode(String s) { @@ -37,7 +43,16 @@ public final class Hex { byte[] b = new byte[len / 2]; for (int i = 0; i < len; i += 2) { - b[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) | Character.digit(s.charAt(i + 1), 16)); + int left = Character.digit(s.charAt(i), 16); + int right = Character.digit(s.charAt(i + 1), 16); + + if (left == -1 || right == -1) { + throw new IllegalArgumentException(MessageFormat.format( + JGitText.get().invalidHexString, + s)); + } + + b[i / 2] = (byte) (left << 4 | right); } return b; } From 1d41be7c54c698d21a54bc1a33b5b23e095d542a Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 5 Mar 2020 13:13:47 +0900 Subject: [PATCH 15/16] Bump Bazel version to 2.2.0 Change-Id: I889052040f31708c6b8de0cf3c171a04722f7c96 Signed-off-by: David Pursehouse --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index 7ec1d6db4..ccbccc3dc 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -2.1.0 +2.2.0 From 241557137070d680cf730ba1633df5e4c4266a1d Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 5 Mar 2020 13:53:10 +0100 Subject: [PATCH 16/16] Silence API errors introduced by 093fbbd1 Change-Id: I1c9d5a25bd06a1152e953c45b683375cb05aa254 Signed-off-by: Matthias Sohn --- org.eclipse.jgit/.settings/.api_filters | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters index 5fc26a553..eb652a252 100644 --- a/org.eclipse.jgit/.settings/.api_filters +++ b/org.eclipse.jgit/.settings/.api_filters @@ -188,6 +188,14 @@ + + + + + + + +