From 684a2a058ab5454f687af316a6ec562b5538589a Mon Sep 17 00:00:00 2001 From: Yuxuan 'fishy' Wang Date: Wed, 27 Aug 2014 16:28:43 -0700 Subject: [PATCH] Handles repo manifest file without default remote. Change-Id: Ic45919a0b695e8a6f4ed47cc060e0c41f1d7e7ea Signed-off-by: Yuxuan 'fishy' Wang --- .../org/eclipse/jgit/gitrepo/RepoCommand.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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 6ff39a49e5..ca15496163 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -473,14 +473,8 @@ public class RepoCommand extends GitCommand { xmlInRead--; if (xmlInRead != 0) return; + // Only do the following after we finished reading everything. - if (defaultRemote == null) { - if (filename != null) - throw new SAXException(MessageFormat.format( - RepoText.get().errorNoDefaultFilename, filename)); - else - throw new SAXException(RepoText.get().errorNoDefault); - } removeNotInGroup(); removeOverlaps(); @@ -493,8 +487,18 @@ public class RepoCommand extends GitCommand { } for (Project proj : projects) { String remote = proj.remote; - if (remote == null) + if (remote == null) { + if (defaultRemote == null) { + if (filename != null) + throw new SAXException(MessageFormat.format( + RepoText.get().errorNoDefaultFilename, + filename)); + else + throw new SAXException( + RepoText.get().errorNoDefault); + } remote = defaultRemote; + } String remoteUrl = remoteUrls.get(remote); if (remoteUrl == null) { remoteUrl = baseUri.resolve(remotes.get(remote)).toString(); -- 2.39.5