Community
Participate
Working Groups
Even though CloneOperation manages to clone remote repo and checkout working tree when branch=refs/tags/sometag, the cloned repo is left is somewhat inconsistent state and running "git branch -a" fails with "fatal: HEAD not found below refs/heads!" message. Doing "git checkout sometag" puts the local repository back into good state as far as I can tell.
I could reproduce that. Bit I already get an exception in the clone wizard: java.lang.StringIndexOutOfBoundsException: String index out of range: -7 at java.lang.String.substring(String.java:1937) at java.lang.String.substring(String.java:1904) at org.eclipse.egit.ui.internal.clone.SourceBranchPage$1.getText(SourceBranchPage.java:128) at org.eclipse.jface.viewers.WrappedViewerLabelProvider.getText(WrappedViewerLabelProvider.java:108) at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:164) at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:145) When I continue I have the same behavior as secribed by Igor. My cloned repo has no HEAD and no branches.
To clarify, I was using CloneOperation directly, without using egit GUI.
I can reproduce the error. The EGit operatoin writes ref: refs/tags/TagForDemo into the HEAD file. This seems not to work. "git checkout sometag" replaces this by the commit id and everything works.
In the proposal http://egit.eclipse.org/r/#change,2003 we changed the API of CloneOperation. The former String parameter "branch" which contained the ref name of the branch to check out is replaced by a parameter of type Ref. This Ref must exist in the cloned repo. An example code how to get such a ref is e.g. in org.eclipse.egit.ui.view.repositories.GitRepositoriesViewBranchHandlingTest.beforeClass(). This should work for tags now.
merged as 35b7b6520355106dd62f2f241e71843a56b62503 will be shipped with 0.10