Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java4
2 files changed, 9 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java
index eb1b72ed9c..7464a5ea3b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java
@@ -190,6 +190,12 @@ public class BranchCommandTest extends RepositoryTestCase {
}
@Test
+ public void testListAllBranchesShouldNotDie() throws Exception {
+ Git git = setUpRepoWithRemote();
+ git.branchList().setListMode(ListMode.ALL).call();
+ }
+
+ @Test
public void testCreateFromCommit() throws Exception {
Ref branch = git.branchCreate().setName("FromInitial").setStartPoint(
initialCommit).call();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
index 8329fca569..846c5385c5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java
@@ -49,6 +49,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
+import java.util.HashMap;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.lib.Constants;
@@ -100,7 +101,8 @@ public class ListBranchCommand extends GitCommand<List<Ref>> {
} else if (listMode == ListMode.REMOTE) {
refList = repo.getRefDatabase().getRefs(Constants.R_REMOTES);
} else {
- refList = repo.getRefDatabase().getRefs(Constants.R_HEADS);
+ refList = new HashMap<String,Ref>(repo.getRefDatabase().getRefs(
+ Constants.R_HEADS));
refList.putAll(repo.getRefDatabase().getRefs(
Constants.R_REMOTES));
}

Back to the top