From fc613e26d83473089a179464c2221f3912806387 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 30 Mar 2023 09:26:26 +0200 Subject: [PATCH 1/3] Use wagon-ssh-external to deploy Maven site Using wagon-ssh stopped working. Try to use wagon-ssh-external instead. Bug: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/2818 Change-Id: I6f8fa771ddf9623b2e528f23f2ebdc871372ba2f --- org.eclipse.jgit.benchmarks/pom.xml | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit.benchmarks/pom.xml b/org.eclipse.jgit.benchmarks/pom.xml index cd9761546..5d5a5f6db 100644 --- a/org.eclipse.jgit.benchmarks/pom.xml +++ b/org.eclipse.jgit.benchmarks/pom.xml @@ -179,8 +179,8 @@ org.apache.maven.wagon - wagon-ssh - 3.5.2 + wagon-ssh-external + 3.5.3 diff --git a/pom.xml b/pom.xml index 4ed91ffc4..ad1e2a81f 100644 --- a/pom.xml +++ b/pom.xml @@ -349,8 +349,8 @@ org.apache.maven.wagon - wagon-ssh - 3.5.2 + wagon-ssh-external + 3.5.3 From 17fac8a27efd5c8b3028b9c244353265b697fb9f Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 30 Mar 2023 22:00:52 +0200 Subject: [PATCH 2/3] Downgrade maven-site-plugin to 3.12.1 This may fix the current authentication failures happening when trying to deploy the jgit Maven site. Change-Id: I55d4706cd041d93194af48fac9e8bfcd067e2cac --- org.eclipse.jgit.benchmarks/pom.xml | 2 +- org.eclipse.jgit.packaging/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit.benchmarks/pom.xml b/org.eclipse.jgit.benchmarks/pom.xml index 5d5a5f6db..ae9c6a323 100644 --- a/org.eclipse.jgit.benchmarks/pom.xml +++ b/org.eclipse.jgit.benchmarks/pom.xml @@ -175,7 +175,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M4 + 3.12.1 org.apache.maven.wagon diff --git a/org.eclipse.jgit.packaging/pom.xml b/org.eclipse.jgit.packaging/pom.xml index a79399ef4..28ae7ceb2 100644 --- a/org.eclipse.jgit.packaging/pom.xml +++ b/org.eclipse.jgit.packaging/pom.xml @@ -313,7 +313,7 @@ org.apache.maven.plugins maven-site-plugin - 3.9.1 + 3.12.1 diff --git a/pom.xml b/pom.xml index ad1e2a81f..37c86135b 100644 --- a/pom.xml +++ b/pom.xml @@ -345,7 +345,7 @@ org.apache.maven.plugins maven-site-plugin - 4.0.0-M4 + 3.12.1 org.apache.maven.wagon From d3ba40c803beaa4351d955ddf0ce7c8d7e9d2322 Mon Sep 17 00:00:00 2001 From: kylezhao Date: Mon, 3 Apr 2023 17:04:38 +0800 Subject: [PATCH 3/3] Ensure parsed RevCommitCG has derived data from commit-graph If a RevCommitCG was newly created and called #parseCanonical(RevWalk, byte[]) method immediately, its flag was marked as PARSED, but no derived data was obtained from the commit-graph. This is different from what we expected. Change-Id: I5d417efa3c42d211f19e6acf255f761e84d84450 Signed-off-by: kylezhao --- .../jgit/revwalk/RevWalkCommitGraphTest.java | 36 +++++++++++++++++++ .../org/eclipse/jgit/revwalk/RevCommit.java | 10 +++++- .../org/eclipse/jgit/revwalk/RevCommitCG.java | 21 ++++++++--- 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkCommitGraphTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkCommitGraphTest.java index 6c8014513..97d3f81b9 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkCommitGraphTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkCommitGraphTest.java @@ -83,6 +83,42 @@ public void testParseHeaders() throws Exception { assertArrayEquals(notParseInGraph.getParents(), noBody.getParents()); } + @Test + public void testParseCanonical() throws Exception { + RevCommit c1 = commitFile("file1", "1", "master"); + enableAndWriteCommitGraph(); + + RevCommit notParseInGraph = rw.lookupCommit(c1); + rw.parseHeaders(notParseInGraph); + + reinitializeRevWalk(); + RevCommit parseInGraph = rw.lookupCommit(c1); + parseInGraph.parseCanonical(rw, rw.getCachedBytes(c1)); + + assertTrue(parseInGraph instanceof RevCommitCG); + assertNotNull(parseInGraph.getRawBuffer()); + assertEquals(1, parseInGraph.getGeneration()); + assertEquals(notParseInGraph.getId(), parseInGraph.getId()); + assertEquals(notParseInGraph.getTree(), parseInGraph.getTree()); + assertEquals(notParseInGraph.getCommitTime(), + parseInGraph.getCommitTime()); + assertArrayEquals(notParseInGraph.getParents(), + parseInGraph.getParents()); + + reinitializeRevWalk(); + rw.setRetainBody(false); + RevCommit noBody = rw.lookupCommit(c1); + noBody.parseCanonical(rw, rw.getCachedBytes(c1)); + + assertTrue(noBody instanceof RevCommitCG); + assertNull(noBody.getRawBuffer()); + assertEquals(1, noBody.getGeneration()); + assertEquals(notParseInGraph.getId(), noBody.getId()); + assertEquals(notParseInGraph.getTree(), noBody.getTree()); + assertEquals(notParseInGraph.getCommitTime(), noBody.getCommitTime()); + assertArrayEquals(notParseInGraph.getParents(), noBody.getParents()); + } + @Test public void testInitializeShallowCommits() throws Exception { RevCommit c1 = commit(commit()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java index e155a2563..b64c9ce90 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java @@ -125,7 +125,15 @@ public static RevCommit parse(RevWalk rw, byte[] raw) throws IOException { int inDegree; - private byte[] buffer; + /** + * Raw unparsed commit body of the commit. Populated only + * after {@link #parseCanonical(RevWalk, byte[])} with + * {@link RevWalk#isRetainBody()} enable or after + * {@link #parseBody(RevWalk)} and {@link #parse(RevWalk, byte[])}. + * + * @since 6.5.1 + */ + protected byte[] buffer; /** * Create a new commit reference. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitCG.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitCG.java index b68f65b68..4d3664da1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitCG.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitCG.java @@ -44,10 +44,27 @@ protected RevCommitCG(AnyObjectId id, int graphPosition) { this.graphPosition = graphPosition; } + /** {@inheritDoc} */ + @Override + void parseCanonical(RevWalk walk, byte[] raw) throws IOException { + if (walk.isRetainBody()) { + buffer = raw; + } + parseInGraph(walk); + } + /** {@inheritDoc} */ @Override void parseHeaders(RevWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException { + if (walk.isRetainBody()) { + super.parseBody(walk); // This parses header and body + return; + } + parseInGraph(walk); + } + + private void parseInGraph(RevWalk walk) throws IOException { CommitGraph graph = walk.commitGraph(); CommitGraph.CommitData data = graph.getCommitData(graphPosition); if (data == null) { @@ -78,11 +95,7 @@ void parseHeaders(RevWalk walk) throws MissingObjectException, this.parents = pList; } } - flags |= PARSED; - if (walk.isRetainBody()) { - super.parseBody(walk); - } } /** {@inheritDoc} */