summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2015-11-24 15:43:05 -0500
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2015-11-24 15:43:06 -0500
commit15e60b646e1af9c6b7bf01d3822dc50162dbf3dc (patch)
treeb11370a691286cad62651950557098276f791f4a /org.eclipse.jgit.test
parent18af2d42657dbe758b0d7ef88efb0cc466105da9 (diff)
parent1e47c7058d930db920cb897faa2df14a4ae87c00 (diff)
downloadjgit-15e60b646e1af9c6b7bf01d3822dc50162dbf3dc.tar.gz
jgit-15e60b646e1af9c6b7bf01d3822dc50162dbf3dc.zip
Merge "RefDirectory.getRef: Treat fake missing symrefs like real ones"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
index d66753da08..52e181bc80 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
@@ -858,6 +858,36 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
}
@Test
+ public void testGetRef_CycleInSymbolicRef() throws IOException {
+ Ref r;
+
+ writeLooseRef("refs/1", "ref: refs/2\n");
+ writeLooseRef("refs/2", "ref: refs/3\n");
+ writeLooseRef("refs/3", "ref: refs/4\n");
+ writeLooseRef("refs/4", "ref: refs/5\n");
+ writeLooseRef("refs/5", "ref: refs/end\n");
+ writeLooseRef("refs/end", A);
+
+ r = refdir.getRef("1");
+ assertEquals("refs/1", r.getName());
+ assertEquals(A, r.getObjectId());
+ assertTrue(r.isSymbolic());
+
+ writeLooseRef("refs/5", "ref: refs/6\n");
+ writeLooseRef("refs/6", "ref: refs/end\n");
+
+ r = refdir.getRef("1");
+ assertNull("missing 1 due to cycle", r);
+
+ writeLooseRef("refs/heads/1", B);
+
+ r = refdir.getRef("1");
+ assertEquals("refs/heads/1", r.getName());
+ assertEquals(B, r.getObjectId());
+ assertFalse(r.isSymbolic());
+ }
+
+ @Test
public void testGetRefs_PackedNotPeeled_Sorted() throws IOException {
Map<String, Ref> all;