From 34dd64f6fe36ace1a90b0b503e2e37d877b7c621 Mon Sep 17 00:00:00 2001 From: Yuxuan 'fishy' Wang Date: Wed, 6 Aug 2014 22:01:08 -0700 Subject: Add support to tag in repo manifest xml. Change-Id: I32d468f92e24701ea680435bf3417e3850857303 Signed-off-by: Yuxuan 'fishy' Wang --- .../org/eclipse/jgit/gitrepo/RepoCommandTest.java | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java index 3e5ef02738..41a086f6be 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java @@ -571,6 +571,46 @@ public class RepoCommandTest extends RepositoryTestCase { assertTrue("The a submodule should exist", a); } + @Test + public void testIncludeTag() throws Exception { + Repository localDb = createWorkRepository(); + Repository tempDb = createWorkRepository(); + + StringBuilder xmlContent = new StringBuilder(); + xmlContent.append("\n") + .append("") + .append("") + .append("") + .append(""); + JGitTestUtil.writeTrashFile( + tempDb, "manifest.xml", xmlContent.toString()); + + xmlContent = new StringBuilder(); + xmlContent.append("\n") + .append("") + .append("") + .append("") + .append("") + .append(""); + JGitTestUtil.writeTrashFile( + tempDb, "_include.xml", xmlContent.toString()); + + RepoCommand command = new RepoCommand(localDb); + command + .setPath(tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") + .setURI(rootUri) + .call(); + File hello = new File(localDb.getWorkTree(), "foo/hello.txt"); + assertTrue("submodule should be checked out", hello.exists()); + BufferedReader reader = new BufferedReader(new FileReader(hello)); + String content = reader.readLine(); + reader.close(); + assertEquals("submodule content should be as expected", + "master world", content); + } + private void resolveRelativeUris() { // Find the longest common prefix ends with "/" as rootUri. defaultUri = defaultDb.getDirectory().toURI().toString(); -- cgit v1.2.3