Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ensure that 'master' is used if HEAD points to it.

Bug 368029
Change-Id: I995ef7f0f98d06e8e319131b7053f4221c702d99
Signed-off-by: Daniel Megert <daniel_megert@ch.ibm.com>
  • Loading branch information...
commit 5bc0ecfc2b74ea28ce0d582392b63dbe02ce7429 1 parent 0ea2356
authored January 12, 2012
12  org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/SourceBranchPage.java
@@ -4,6 +4,7 @@
4 4
  * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
5 5
  * Copyright (C) 2010, Mathias Kinzler <mathias.kinzler@sap.com>
6 6
  * Copyright (c) 2010, Benjamin Muskalla <bmuskalla@eclipsesource.com>
  7
+ * Copyright (c) 2012, IBM Corporation
7 8
  *
8 9
  * All rights reserved. This program and the accompanying materials
9 10
  * are made available under the terms of the Eclipse Public License v1.0
@@ -342,15 +343,20 @@ public void run(IProgressMonitor monitor)
342 343
 
343 344
 		final Ref idHEAD = listRemoteOp.getRemoteRef(Constants.HEAD);
344 345
 		head = null;
  346
+		boolean headIsMaster = false;
  347
+		final String masterBranchRef = Constants.R_HEADS + Constants.MASTER;
345 348
 		for (final Ref r : listRemoteOp.getRemoteRefs()) {
346 349
 			final String n = r.getName();
347 350
 			if (!n.startsWith(Constants.R_HEADS))
348 351
 				continue;
349 352
 			availableRefs.add(r);
350  
-			if (idHEAD == null || head != null)
  353
+			if (idHEAD == null || headIsMaster)
351 354
 				continue;
352  
-			if (r.getObjectId().equals(idHEAD.getObjectId()))
353  
-				head = r;
  355
+			if (r.getObjectId().equals(idHEAD.getObjectId())) {
  356
+				headIsMaster = masterBranchRef.equals(r.getName());
  357
+				if (head == null || headIsMaster)
  358
+					head = r;
  359
+			}
354 360
 		}
355 361
 		Collections.sort(availableRefs, new Comparator<Ref>() {
356 362
 			public int compare(final Ref o1, final Ref o2) {

Git Notes

review

Code-Review+2: Robin Rosenberg <robin.rosenberg@dewire.com>
IP-Clean+1: Robin Rosenberg <robin.rosenberg@dewire.com>
Verified+1: Hudson CI
Submitted-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Submitted-at: Fri, 13 Jan 2012 04:17:06 -0500
Reviewed-on: http://egit.eclipse.org/r/4929
Project: egit
Branch: refs/heads/master

0 notes on commit 5bc0ecf

Please sign in to comment.
Something went wrong with that request. Please try again.