diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-27 02:30:20 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-04-27 02:30:20 +0200 |
commit | 34a81889b8d8a6e84ffaf86deca8eb15bfb250ab (patch) | |
tree | 6ed312f660d52ddc3a02fec2bab9dda734b1704e /org.eclipse.jgit.test/tst/org/eclipse/jgit | |
parent | 032eef5b12a25e0da48004eea589966ae0652433 (diff) | |
parent | f87c456e8ac1fa341f1c3a618798738245bf8adb (diff) | |
download | jgit-34a81889b8d8a6e84ffaf86deca8eb15bfb250ab.tar.gz jgit-34a81889b8d8a6e84ffaf86deca8eb15bfb250ab.zip |
Merge branch 'stable-6.4' into stable-6.5
* stable-6.4:
[bazel] Move ToolTestCase to src folder (6.2)
GcConcurrentTest: @Ignore flaky testInterruptGc
Fix CommitTemplateConfigTest
Fix after_open config and Snapshotting RefDir tests to work with bazel
[bazel] Skip ConfigTest#testCommitTemplatePathInHomeDirecory
Demote severity of some error prone bug patterns to warnings
UploadPack: Fix NPE when traversing a tag chain
Change-Id: I6d20fea3a417e4361b61e81756253343668eb5de
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java | 2 | ||||
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java | 69 |
2 files changed, 71 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java index 5f52e6b220..1519873b62 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java @@ -43,6 +43,7 @@ import org.eclipse.jgit.revwalk.RevBlob; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.storage.file.FileBasedConfig; import org.eclipse.jgit.test.resources.SampleDataRepositoryTestCase; +import org.junit.Ignore; import org.junit.Test; public class GcConcurrentTest extends GcTestCase { @@ -197,6 +198,7 @@ public class GcConcurrentTest extends GcTestCase { assertNotNull(getSinglePack(repository).getBitmapIndex()); } + @Ignore @Test public void testInterruptGc() throws Exception { FileBasedConfig c = repo.getConfig(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 0e97d7b155..61458dddfb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -2587,6 +2587,75 @@ public class UploadPackTest { } @Test + public void testSingleBranchShallowCloneTagChainWithReflessTag() throws Exception { + RevCommit one = remote.commit().message("1").create(); + remote.update("master", one); + RevTag tag1 = remote.tag("t1", one); + remote.lightweightTag("t1", tag1); + RevTag tag2 = remote.tag("t2", tag1); + RevTag tag3 = remote.tag("t3", tag2); + remote.lightweightTag("t3", tag3); + + UploadPack uploadPack = new UploadPack(remote.getRepository()); + + ByteArrayOutputStream cli = new ByteArrayOutputStream(); + PacketLineOut clientWant = new PacketLineOut(cli); + clientWant.writeString("want " + one.name() + " include-tag"); + clientWant.writeString("deepen 1\n"); + clientWant.end(); + clientWant.writeString("done\n"); + + try (ByteArrayOutputStream serverResponse = new ByteArrayOutputStream()) { + + uploadPack.setPreUploadHook(new PreUploadHook() { + @Override + public void onBeginNegotiateRound(UploadPack up, + Collection<? extends ObjectId> wants, int cntOffered) + throws ServiceMayNotContinueException { + // Do nothing. + } + + @Override + public void onEndNegotiateRound(UploadPack up, + Collection<? extends ObjectId> wants, int cntCommon, + int cntNotFound, boolean ready) + throws ServiceMayNotContinueException { + // Do nothing. + } + + @Override + public void onSendPack(UploadPack up, + Collection<? extends ObjectId> wants, + Collection<? extends ObjectId> haves) + throws ServiceMayNotContinueException { + // collect pack data + serverResponse.reset(); + } + }); + uploadPack.upload(new ByteArrayInputStream(cli.toByteArray()), + serverResponse, System.err); + ByteArrayInputStream packReceived = new ByteArrayInputStream( + serverResponse.toByteArray()); + PackLock lock = null; + try (ObjectInserter ins = client.newObjectInserter()) { + PackParser parser = ins.newPackParser(packReceived); + parser.setAllowThin(true); + parser.setLockMessage("receive-tag-chain"); + ProgressMonitor mlc = NullProgressMonitor.INSTANCE; + lock = parser.parse(mlc, mlc); + ins.flush(); + } finally { + if (lock != null) { + lock.unlock(); + } + } + InMemoryRepository.MemObjDatabase objDb = client + .getObjectDatabase(); + assertTrue(objDb.has(one.toObjectId())); + } + } + + @Test public void testSafeToClearRefsInFetchV0() throws Exception { server = new RefCallsCountingRepository( |