Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] How to determine remote HEAD from advertised refs?

Is there a way to find out the branch the HEAD points to at a remote repository?
 
The method OperationResult.getAdvertisedRef returns a sha1 for the parameter “HEAD”
but not the branch HEAD points to in the remote repository.
 
In EGit we try to find a branch which points to the same commit and use this as a base
for the local branch to create and checkout after clone.
 
In the JGit CloneCommand however there is no such logic and as a result the HEAD is detached
after clone (see bugs 339354, 339254).
 
The logic implemented in EGit is not nice because it may result in the wrong branch if more
than one branches point to the same commit.
 

Back to the top