Skip to contentSkip to conversation

Add test for resolving "tag^{tree}" where "tag" points to a tag

PATCH In review Jonas Fonseca 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Add test for resolving "tag^{tree}" where "tag" points to a tag

---
 .../spearce/jgit/test/resources/create-second-pack |    4 ++++
 ...ck-9c51502a527e1cc8ad4016629730bd1b90145dd6.idx |  Bin 0 -> 1100 bytes
 ...k-9c51502a527e1cc8ad4016629730bd1b90145dd6.pack |  Bin 0 -> 167 bytes
 .../org/spearce/jgit/test/resources/packed-refs    |    2 ++
 .../org/spearce/jgit/lib/RepositoryTestCase.java   |    1 +
 .../org/spearce/jgit/lib/T0008_testparserev.java   |    7 ++++++-
 6 files changed, 13 insertions(+), 1 deletions(-)
 create mode 100644 org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9c51502a527e1cc8ad4016629730bd1b90145dd6.idx
 create mode 100644 org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9c51502a527e1cc8ad4016629730bd1b90145dd6.pack
org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/create-second-pack +4 -0
index 03f83dc..ea02240 100755
@@ -130,6 +130,10 @@ git tag -a -m "An annotated tag" B a^
 
 git repack -d
 
+git tag -a -m "An annotated tag tagging a tag" C B
+
+git repack -d
+
 git pack-refs --all
 
 
org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9c51502a527e1cc8ad4016629730bd1b90145dd6.idx new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8405f4c6ec64f8519e17e69702bc35950e128cb6
GIT binary patch
org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/pack-9c51502a527e1cc8ad4016629730bd1b90145dd6.pack new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..14fa6c4d3abbd372b093f78dc43fe51fa19b7b70
GIT binary patch
org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/test/resources/packed-refs +2 -0
index f67a3ef..fc280c7 100644
@@ -9,5 +9,7 @@ d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864 refs/heads/pa
 6db9c2ebf75590eef973081736730a9ea169a0c4 refs/tags/A
 17768080a2318cd89bba4c8b87834401e2095703 refs/tags/B
 ^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864
+be83157b4ffe650d728ba4f98ad47b623b0d0c20 refs/tags/C
+^d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864
 8bbde7aacf771a9afb6992434f1ae413e010c6d8 refs/tags/spearce-gpg-pub
 ^fd608fbe625a2b456d9f15c2b1dc41f252057dd7
org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java +1 -0
index 270b90a..b40d7b1 100644
@@ -141,6 +141,7 @@ public void run() {
 				"pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f",
 				"pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371",
 				"pack-9fb5b411fe6dfa89cc2e6b89d2bd8e5de02b5745",
+				"pack-9c51502a527e1cc8ad4016629730bd1b90145dd6",
 				"pack-e6d07037cbcf13376308a0a995d1fa48f8f76aaa"
 		};
 		final File packDir = new File(db.getObjectsDirectory(), "pack");
org.spearce.jgit.test/tst/org/spearce/jgit/lib/T0008_testparserev.java +6 -1
index 3457574..2a1a4ad 100644
@@ -116,10 +116,15 @@ public void testDerefTagIssue23() throws IOException {
 		assertEquals("d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864",db.resolve("refs/tags/B^0").name());
 	}
 
+	public void testDerefTaggedTagTree() throws IOException {
+		assertEquals("269e1253bad5c247c6bde37aa48ae1e03138206c",db.resolve("refs/tags/C").name());
+		assertEquals("d86a2aada2f5e7ccf6f11880bfb9ab404e8a8864",db.resolve("refs/tags/C^{commit}").name());
+		assertEquals("856ec208ae6cadac25a6d74f19b12bb27a24fe24",db.resolve("refs/tags/C^{tree}").name());
+	}
+
 	public void testDerefBlob() throws IOException {
 		assertEquals("fd608fbe625a2b456d9f15c2b1dc41f252057dd7",db.resolve("fd608fbe625a2b456d9f15c2b1dc41f252057dd7^{}").name());
 		assertEquals("fd608fbe625a2b456d9f15c2b1dc41f252057dd7",db.resolve("fd608fbe625a2b456d9f15c2b1dc41f252057dd7^{blob}").name());
 	}
 
-	// TODO: ^{tree} for a tag pointing to a tag
 }
Signature · 5 lines
1.6.0.336.ga07ba


-- 
Jonas Fonseca