| Summary: | Can't checkout local branch that has the same name as a tag | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Remy Suen <remy.suen> |
| Component: | Node | Assignee: | Remy Suen <remy.suen> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | steve_northover |
| Version: | 13.0 | ||
| Target Milestone: | 15.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Remy Suen
This boolean check is failing so nothing is happening. https://github.com/nodegit/nodegit/blob/v0.16.0/lib/repository.js#L311-L313 See bug 347289. It seems that a similar problem happened many moons ago with the Java server. Quite simply, the fix is to prepend the "refs/heads/" string prior to checking out the branch. https://github.com/eclipse/orion.client/blob/e10609e58dc278f8f7e9d00643c10f5890d7a3da/modules/orionode/lib/git/clone.js#L431 This has the unfortunate side effect of breaking clients that previously sent in a fully qualified name for the checkout. However, given that the Java server also prepends this string, I'm inclined to let this go. https://github.com/eclipse/orion.server/blob/f3cc7aec9f1b6fb19546bff03eceb49dd125bbd0/bundles/org.eclipse.orion.server.git/src/org/eclipse/orion/server/git/servlets/GitCloneHandlerV1.java#L426 Alternatively, we massage the Orion client to prepend the "refs/heads/" string and remove that string concatenation on the Java server and ask our API consumers to use a fully qualified branch name in the parameter. https://github.com/eclipse/orion.client/blob/b60bda327af4012a1201cffc8e0810144b776f40/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js#L407 However, the Git API has never expected the fully qualified branch name for the parameter and the simple name is what's written on the wiki page so I'm leaning towards making the behaviour of the Node server match the Java server instead of forcing clients to change their API calls to use a fully qualified reference. https://wiki.eclipse.org/index.php?title=Orion/Server_API/Git_API&diff=258174&oldid=258172#Checking_out_a_branch One could perhaps argue we could choose to modify both the Java and the Node server to prepend the string if and only if the string isn't already there but I feel that a simple API is better than one with conveniences built-in to help massage the parameters of the API. I have opened a pull request against NodeGit that illustrates the failure. https://github.com/nodegit/nodegit/pull/1250 (In reply to Remy Suen from comment #3) > https://wiki.eclipse.org/index.php?title=Orion/Server_API/ > Git_API&diff=258174&oldid=258172#Checking_out_a_branch Sorry, I copied the right link. Here's the right diff to the wiki page. https://wiki.eclipse.org/index.php?title=Orion/Server_API/Git_API&diff=next&oldid=258174 I've decided to make the Node server match the Java server as that seems to be the best way to provide compatibility. I have delivered the first pass of the fix to master. https://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=d4033e43564dd356412bd4171ab23cd21e7233e4 This fixes the latter problem where you can't checkout a branch with the same name as the tag. The first problem encountered in comment 0 is that creating a branch off of an existing tag will fail to automatically checkout the branch. Trying to checkout a tag (which will cause the server to both create the branch and check it out) with the created branch having the same name as the tag now works too. https://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=c7ff8130a9b928eed30f322a34cde70cbe7ee688 |