summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorYuxuan 'fishy' Wang <fishywang@google.com>2014-08-06 22:01:08 -0700
committerYuxuan 'fishy' Wang <fishywang@google.com>2014-08-13 13:04:28 -0700
commit34dd64f6fe36ace1a90b0b503e2e37d877b7c621 (patch)
treeec8e9e85a04f590853cb151dffb3a993283c7221 /org.eclipse.jgit.test
parentb1bea5411354ef257b832c83b3f2fc0b3af1da77 (diff)
downloadjgit-34dd64f6fe36ace1a90b0b503e2e37d877b7c621.tar.gz
jgit-34dd64f6fe36ace1a90b0b503e2e37d877b7c621.zip
Add support to <include> tag in repo manifest xml.
Change-Id: I32d468f92e24701ea680435bf3417e3850857303 Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java40
1 files changed, 40 insertions, 0 deletions
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("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<include name=\"_include.xml\" />")
+ .append("<default revision=\"master\" remote=\"remote1\" />")
+ .append("</manifest>");
+ JGitTestUtil.writeTrashFile(
+ tempDb, "manifest.xml", xmlContent.toString());
+
+ xmlContent = new StringBuilder();
+ xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"remote1\" fetch=\".\" />")
+ .append("<default revision=\"master\" remote=\"remote1\" />")
+ .append("<project path=\"foo\" name=\"")
+ .append(defaultUri)
+ .append("\" />")
+ .append("</manifest>");
+ 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();