8 Replies Latest reply on Dec 5, 2014 6:38 AM by simplex-software

    JBDS 8 - GIT plugin won't add an existing local repository

    simplex-software

      Hello,

       

      Using JBoss Developer Studio 8.0.0.GA Build id: GA-v20141020-1042-B317. Using GitHub shell, I have created a local GIT repository, added stuff in it and committed. Now with JBDS I go into the GIT perspective and try to add my repository. I'm browsing the file system and I select the repository location but the plugin says "No GIT repositories found". However, if I modify a file in the JBDS workspace and go back to the GIT shell I'm seeing the modification in git status and I can commit it.

       

      So the repository exists, it tracks my modifications, but for some reason JBDS doesn't see it. I mention that I initialized the repository as follows: git --work-tree <my Eclipse workspace> --git-dir <the repo dir> init

       

      Many thanks in advance for your help.

       

      Nicolas

        • 1. Re: JBDS 8 - GIT plugin won't add an existing local repository
          mickael_istria

          Seems strange, Eclipse usually connects your project immediatly... As a workaround, please try the following: on your project in your workspace, try Right-Click > Team > Share > Git. Hopefully, it will detect the .git folder in the project and it will enable tracking.

          • 2. Re: JBDS 8 - GIT plugin won't add an existing local repository
            simplex-software

            There is no .git folder. As explained I have created a GIT repository having a customized layout via the git-dir and work-tree. Hence, the GIT directory (the place where the GIT own folders are) is in ~/git-repo while the work dir (the place where my files are) is ~/workspace. This is a quite common layout. Do you mean that the GIT plugin is not able to use a non-default GIT layout ?

            • 3. Re: JBDS 8 - GIT plugin won't add an existing local repository
              mickael_istria

              That's the first time I hear about such layout. What's the benefit of this approach versus importing projects from "regular" Git repositories (referencing them, not copying them) in workspace? I don't know whether EGit support thie approach you mention, I'm afraid it does not, and it will require to find a .git folder in the project or a parent to understand how to connect to Git. Cf https://wiki.eclipse.org/EGit/User_Guide#Eclipse_Workspace_and_Repository_working_directory The only suggestion I can make is that you try the regular approach, that seems to be simpler and better integrated in EGit (and other tools I imagine).

              • 4. Re: JBDS 8 - GIT plugin won't add an existing local repository
                maxandersen

                Like Michael, this is the first time I've ever seen anyone use this kind of layout. I've used it myself in the past but only for some eccentric scripting

                 

                That said I went and tried it in eclipse and yes it does actually support it but as you can imagine it does make it more cumbersome

                 

                I did the following:

                 

                git clone --work-tree=myworktree <giturl>

                 

                Now I go to the Git perspective and click "Add git repositories" and put the parent path of myworktree and click Search and it shows up and I can import it and use it as any other git repository.

                • 5. Re: JBDS 8 - GIT plugin won't add an existing local repository
                  simplex-software

                  "That's the first time I hear about such layout."

                   

                  Well, then you're probably not a GIT practitioner.

                   

                  "What's the benefit of this approach versus importing projects from "regular" Git repositories (referencing them, not copying them) in workspace? "

                  This is not in the scope of my issue but since you're sending me links to the documentation, you've noticed probably the following statement: It is a good idea to keep your Repository outside of your Eclipse Workspace.

                   

                  "I don't know whether EGit support thie approach you mention"

                  Thank you anyway for having taken the time to reply to my post. But if EGIT doesn't support this approach it means it doesn't support GIT as I'm trying to connect my workspace to an existent GIT repository, perfectly valid and 100% regular, supporting all the operations while using with GIT shell, but the Eclipse plug-in doesn't see it.

                  • 6. Re: JBDS 8 - GIT plugin won't add an existing local repository
                    mickael_istria

                    > Well, then you're probably not a GIT practitioner.

                    I am a Git user, but as for any technology or tool, I prefer to keep using efficiently the basics than depending on the more complex usages (that as you can see are often not supported and understood by all people or tools).

                    > you've noticed probably the following statement: It is a good idea to keep your Repository outside of your Eclipse Workspace.

                    This statement is not incompatible with the scenario I mention. The approach recommended by EGit and that we recommend too for JBoss Developer Studio is that project stays out of the workpsace folder, and be imported as remote *references* inside the workpsace (not folder, the concept) instead of copied and included in the workpsace folder. With this, you don't need to have different folders for .git and actual working tree, and everything works fine. For example, if you clone your project with EGit, it will first clone it in your $HOME/git directory by default, and then it will import the content as reference in the workpsace. It doesn't change anything in term of usability compared to having projects in the workspace folder.

                    • 7. Re: JBDS 8 - GIT plugin won't add an existing local repository
                      simplex-software

                      Hi Max,

                       

                      Did you try to create a new GIT local repository as follows:

                       

                      git --work-tree ~/work-tree --git-dir ~/git-dir init

                       

                      and, after adding and commiting some stuff in it, to confirm that it is visible with EGIT ?

                       

                      Many thanks in advance.

                      • 8. Re: JBDS 8 - GIT plugin won't add an existing local repository
                        simplex-software

                        I'm updating the case with the last results. As EGit doesn't seem to be able to access customized layout repositories having other names then .git, I created a new test repository as follows:

                         

                        git --work-tree <My Eclipse workspace> --git-dir ./.git init

                         

                        Notice that by doing this it is not the EGit plugin which serves my needs but it is me who serve the EGit plugin expectations. Anyway ... Now, at the Eclipse side I'm able to add a new existent GIT repository. The repository gets added and it's visible in the Git perspective. But when I try to share my projects via the new created repository, everything seems to be okay, with the exception that the projects aren't shared. Clicking again on projects and doing again Team the only option you have is Apply Patch and Share Projects. So, you can repeat the share operation 10 times, the projects you want to share are simply not shared. Here is thes stack dump in the log file:

                         

                        !ENTRY org.eclipse.ui.navigator 4 2 2014-12-05 11:08:05.968

                        !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.navigator".

                        !STACK 0

                        java.lang.NullPointerException

                            at org.eclipse.jpt.common.ui.internal.jface.ItemTreeStateProviderManager.getChildren(ItemTreeStateProviderManager.java:74)

                            at org.eclipse.jpt.common.ui.internal.navigator.NavigatorContentProvider.getChildren(NavigatorContentProvider.java:109)

                            at org.eclipse.ui.internal.navigator.extensions.SafeDelegateTreeContentProvider.getChildren(SafeDelegateTreeContentProvider.java:96)

                            at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider$1.run(NavigatorContentServiceContentProvider.java:152)

                            at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)

                            at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.internalGetChildren(NavigatorContentServiceContentProvider.java:139)

                            at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.getChildren(NavigatorContentServiceContentProvider.java:119)

                            at org.eclipse.jst.jee.ui.internal.navigator.JEE5ContentProvider$1.run(JEE5ContentProvider.java:142)

                            at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)

                            at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)

                            at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)

                            at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)

                            at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:175)

                            at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:390)

                            at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:527)

                            at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:284)

                            at org.eclipse.ui.actions.CopyProjectOperation.performProjectCopy(CopyProjectOperation.java:180)

                            at org.eclipse.ui.actions.CopyProjectOperation.copyProject(CopyProjectOperation.java:127)

                            at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$ProjectPaster.pasteProjects(PasteAction.java:1201)

                            at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$ProjectPaster.pasteProjects(PasteAction.java:1195)

                            at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction$ProjectPaster.paste(PasteAction.java:1191)

                            at org.eclipse.jdt.internal.ui.refactoring.reorg.PasteAction.run(PasteAction.java:273)

                            at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)

                            at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)

                            at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)

                            at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:122)

                            at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)

                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                            at java.lang.reflect.Method.invoke(Method.java:606)

                            at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)

                            at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)

                            at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)

                            at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)

                            at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)

                            at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)

                            at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)

                            at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)

                            at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:286)

                            at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:507)

                            at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:558)

                            at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:378)

                            at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:324)

                            at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:86)

                            at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

                            at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)

                            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)

                            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)

                            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)

                            at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1112)

                            at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)

                            at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1529)

                            at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4722)

                            at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:6028)

                            at org.eclipse.swt.widgets.Control.windowProc(Control.java:4610)

                            at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:6024)

                            at org.eclipse.swt.widgets.Display.windowProc(Display.java:5023)

                            at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)

                            at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)

                            at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)

                            at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)

                            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                            at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)

                            at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)

                            at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)

                            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                            at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)

                            at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)

                            at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)

                            at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

                            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)

                            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)

                            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)

                            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)

                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                            at java.lang.reflect.Method.invoke(Method.java:606)

                            at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)

                            at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)

                            at org.eclipse.equinox.launcher.Main.run(Main.java:1465)

                            at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

                         

                        Finally, the only way that I managed to get things working is having the .git sub-directory in the project's parent folder, which is exactly what the EGit documentation  advises against. Very confusing !