aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorKevin Sawicki <kevin@github.com>2011-11-28 11:00:15 -0800
committerKevin Sawicki <kevin@github.com>2011-11-28 11:00:15 -0800
commit899114f63c24223b697afb42e1564fc21a3b622d (patch)
treeef23a684afa8c05f944543c33e42abc8fd894567 /org.eclipse.jgit
parentd497c2ac2da24de8865b0f113e07a559a4af951a (diff)
downloadjgit-899114f63c24223b697afb42e1564fc21a3b622d.tar.gz
jgit-899114f63c24223b697afb42e1564fc21a3b622d.zip
Always checkout master when it matches the advertised HEAD
This parallels the CGit behavior of always using refs/heads/master when it matches the remote advertised HEAD commit. Change-Id: I5a5cd1516b58d116e334056aba1ef7990697ec30
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
index dbc126e895..b779c488aa 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -229,6 +229,12 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
final Ref idHEAD = result.getAdvertisedRef(Constants.HEAD);
if (idHEAD == null)
return null;
+
+ Ref master = result.getAdvertisedRef(Constants.R_HEADS
+ + Constants.MASTER);
+ if (master != null && master.getObjectId().equals(idHEAD.getObjectId()))
+ return master;
+
Ref foundBranch = null;
for (final Ref r : result.getAdvertisedRefs()) {
final String n = r.getName();