| Summary: | Creating a branch from a tag results in bad HEAD | ||
|---|---|---|---|
| Product: | [Technology] EGit | Reporter: | Carsten Pfeiffer <carsten.pfeiffer> |
| Component: | Core | Assignee: | Matthias Sohn <matthias.sohn> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ctron, matthias.sohn, mr.l.gauthier, sasa.zivkov |
| Version: | unspecified | ||
| Target Milestone: | 1.1 | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Carsten Pfeiffer
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 |