summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java35
1 files changed, 35 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 9fc59c578e..27d3220797 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
@@ -178,6 +178,41 @@ public class RepoCommandTest extends RepositoryTestCase {
assertTrue("\"all,-a\" has have b", file.exists());
}
+ @Test
+ public void testRepoManifestCopyfile() throws Exception {
+ Repository localDb = createWorkRepository();
+ StringBuilder 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("<copyfile src=\"hello.txt\" dest=\"Hello\" />")
+ .append("</project>")
+ .append("</manifest>");
+ JGitTestUtil.writeTrashFile(localDb, "manifest.xml", xmlContent.toString());
+ RepoCommand command = new RepoCommand(localDb);
+ command.setPath(localDb.getWorkTree().getAbsolutePath() + "/manifest.xml")
+ .setURI(rootUri)
+ .call();
+ // The original file should exist
+ File hello = new File(localDb.getWorkTree(), "foo/hello.txt");
+ assertTrue("The original file exists", hello.exists());
+ BufferedReader reader = new BufferedReader(new FileReader(hello));
+ String content = reader.readLine();
+ reader.close();
+ assertEquals("The original file has expected content", "world", content);
+ // The dest file should also exist
+ hello = new File(localDb.getWorkTree(), "Hello");
+ assertTrue("The destination file exists", hello.exists());
+ reader = new BufferedReader(new FileReader(hello));
+ content = reader.readLine();
+ reader.close();
+ assertEquals("The destination file has expected content", "world", content);
+ }
+
private void resolveRelativeUris() {
// Find the longest common prefix ends with "/" as rootUri.
defaultUri = defaultDb.getDirectory().toURI().toString();