DESCRIPTION

Use 'master' if more than one ref matches HEAD

Bug 368029
Change-Id: I995ef7f0f98d06e8e319131b7053f4221c702d99
Signed-off-by: Jaelyn Mcpherson xxx@xxx.xxx

COMMENTS

author: Brenden Conley
date: 2012-01-06 13:48:51.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/2244/ 

-------------------------------------
author: Brenden Conley
date: 2012-01-06 14:03:09.000000000

Patch Set 1: I would prefer that you didn't submit this

Build Unstable 
 
https://hudson.eclipse.org/sandbox/job/egit.gerrit/2244/ : UNSTABLE

-------------------------------------
author: Douglas Trujillo
date: 2012-01-07 01:08:19.000000000

Patch Set 1:

If I get it right according to [1] EGit currently is matching native Git's behavior, so FWIW if we change this logic in EGit the corresponding change should be also done in native Git.

Anyway it's a heuristic approach as currently the Git transport protocol doesn't allow to disambiguate which branch is the default branch in the remote repository if more than one branch points at the same commit HEAD is referring to.

[1] http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg01040.html

-------------------------------------
author: Jaidyn Nichols
date: 2012-01-07 01:27:39.000000000

Patch Set 1:

I believe this change mirrors a change made to JGit [1] to default to master if multiple advertised refs match HEAD. This matched up with the current behavior of CGit [2].

[1] https://github.com/eclipse/jgit/commit/899114f63c24223b697afb42e1564fc21a3b622d
[2] https://github.com/git/git/blob/master/remote.c#L1636

-------------------------------------
author: Sebastian Porter
date: 2012-01-07 08:14:35.000000000

Patch Set 1:

Another (maybe better?) fix could be to return the "correct" ref (the one that is listed in .git/HEAD) when calling:
listRemoteOp.getRemoteRef(Constants.HEAD);

.git/HEAD contains ref: refs/heads/master, hence we already know it is 'master' and not some other ref. This would also improve the case where HEAD points to a different branch, like e.g. ref: refs/heads/R3_development. Currently, for this case we might still return the wrong ref, even with my patch.

-------------------------------------
author: Douglas Trujillo
date: 2012-01-07 11:15:02.000000000

Patch Set 1:

yeah, this sounds good. In the mean time I tried with c git and found that it returns master if multiple branches point at the same commit HEAD refers to, so ignore my previous comment.

-------------------------------------
author: Jaidyn Nichols
date: 2012-01-07 18:11:26.000000000

Patch Set 1:

ListRemoteOperation is probably due for some updating, it doesn't currently use the JGit LsRemoteCommand

-------------------------------------
author: Juliet Cantu
date: 2012-01-10 21:23:56.000000000

Patch Set 1:

The description of this is incomplete. Master is only chosen when one of the dups is master, otherwise anyone of the dups is chosen.

-------------------------------------
