Community
Participate
Working Groups
Build Identifier: I20100608-0911 When creating a local branch from an existing tag, the refs/heads/newbranch file contains the wrong object (tag instead of commit). git fsck shows this: error: HEAD: not a commit error: refs/heads/newbranch: not a commit newbranch contains the tag, but it should contain the commit. Reproducible: Always Steps to Reproduce: 1. clone http://github.com/unclebob/fitnesse 2. create a local branch with egit and choose refs/tags/20110104 as source branch 3. run git fsck on the clone
I'm using the nightly build from 20110323. #336291 shows a similar problem.
I am seeing this same issue on Windows. Creating a branch from a tag using Egit/Eclipse and then trying to commit some changes later from the command line (msysgit) results in a segmentation fault of git.
I thought I would do a bit analysis on the probable cause of the failure here. I went through the Egit code on github and here is what I have noticed: https://github.com/eclipse/egit/blob/master/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/CreateBranchWizard.java In this Wizard class there are two constructors one using a Commit as the basis for the branch, and the other using a Ref (Tag) as the basis for the branch. https://github.com/eclipse/egit/blob/master/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/BranchSelectionDialog.java This is the class from which the Wizard class is created, with the following code: CreateBranchWizard wiz = new CreateBranchWizard(repo, refFromDialog()); The refFromDialog() method is implemented in: https://github.com/eclipse/egit/blob/master/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/AbstractBranchSelectionDialog.java The branch created from a Tag is itself created in the createBranch() method of CreateBranchPage class by the following code: cbop = new CreateLocalBranchOperation(myRepository, newRefName, myRepository.getRef(this.branchCombo.getText()), upstreamConfig); If we look at the handling of this in: https://github.com/eclipse/egit/blob/master/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CreateLocalBranchOperation.java Here (in the execute method) what we see is that branches created based on tags and branches are processed in the same way. I guess maybe these two paths should be differentiated at least a this stage... What do you think?
More analysis details... If from the command line you create two tags in the following ways: git tag RELEASE_1.0 and git tag -a RELEASE_2.0 The RELEASE_2.0 tag is created as a proper tag object. Egit will create a perfectly working branch from the RELEASE_1.0 tag, but the branch created from RELEASE_2.0 tag will fail during commit... So the redux is that the "Create branch from tag" functionality fails if the tag is actually a "tag object".
This seems still to be an issue with egit 0.12.1. "git branch branchname refs/tags/tagname" from the command line works though.
This was caused by the CreateBranchCommadn in JGit. JGit bug fix proposed at: http://egit.eclipse.org/r/#change,3816