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 5f2aece47..d24d375cb 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
@@ -641,6 +641,30 @@ public class RepoCommandTest extends RepositoryTestCase {
assertTrue("We should have bar", file.exists());
}
+ @Test
+ public void testRemoteAlias() throws Exception {
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append("\n")
+ .append("")
+ .append("")
+ .append("")
+ .append("")
+ .append("");
+
+ Repository localDb = createWorkRepository();
+ JGitTestUtil.writeTrashFile(
+ localDb, "manifest.xml", xmlContent.toString());
+ RepoCommand command = new RepoCommand(localDb);
+ command
+ .setPath(localDb.getWorkTree().getAbsolutePath() + "/manifest.xml")
+ .setURI(rootUri)
+ .call();
+ File file = new File(localDb.getWorkTree(), "foo/hello.txt");
+ assertTrue("We should have foo", file.exists());
+ }
+
private void resolveRelativeUris() {
// Find the longest common prefix ends with "/" as rootUri.
defaultUri = defaultDb.getDirectory().toURI().toString();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
index 3bf3c1884..6ff39a49e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
@@ -407,8 +407,11 @@ public class RepoCommand extends GitCommand {
attributes.getValue("remote"), //$NON-NLS-1$
attributes.getValue("groups")); //$NON-NLS-1$
} else if ("remote".equals(qName)) { //$NON-NLS-1$
- remotes.put(attributes.getValue("name"), //$NON-NLS-1$
- attributes.getValue("fetch")); //$NON-NLS-1$
+ String alias = attributes.getValue("alias"); //$NON-NLS-1$
+ String fetch = attributes.getValue("fetch"); //$NON-NLS-1$
+ remotes.put(attributes.getValue("name"), fetch); //$NON-NLS-1$
+ if (alias != null)
+ remotes.put(alias, fetch);
} else if ("default".equals(qName)) { //$NON-NLS-1$
defaultRemote = attributes.getValue("remote"); //$NON-NLS-1$
defaultRevision = attributes.getValue("revision"); //$NON-NLS-1$