Community
Participate
Working Groups
Build Identifier: 20110301-1815 The clone wizard when lanuched from the import wizard allows new projects to be created from git repo. Based on STR, I was able to select a remote git repo w/ no branches. The branch selection combo is disabled as no branches exist, however the finish button is enabled. GitCloneWizard.java tries to create a project and references the initial branch from the combo control on CloneDestinationPage.java via getInitialBranch(). This method returns null and the wizard fails silently with the following stack trace: java.lang.NullPointerException at org.eclipse.egit.ui.internal.clone.GitCloneWizard.performClone(GitCloneWizard.java:192) at org.eclipse.egit.ui.internal.clone.GitCloneWizard.performFinish(GitCloneWizard.java:152) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.eclipse.egit.ui.internal.clone.GitSelectRepositoryPage$2.widgetSelected(GitSelectRepositoryPage.java:137) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.eclipse.ui.internal.handlers.WizardHandler$Import.executeHandler(WizardHandler.java:147) at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:274) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241) at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157) at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:171) at org.eclipse.ui.actions.ImportResourcesAction.run(ImportResourcesAction.java:97) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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:616) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575) at org.eclipse.equinox.launcher.Main.run(Main.java:1408) at org.eclipse.equinox.launcher.Main.main(Main.java:1384) Reproducible: Always Steps to Reproduce: 1. Create empty (remote?) git repository 2. Import project -> Git -> clone, select empty repo url 3. Get to final page in clone dialog, note NPE in error log
Created attachment 192911 [details] Clone Wizard: Don't allow wizard to finish if initial branch is not set in the UI. See bugzilla comment for patch details.
I've submitted a simple patch that will prevent the wizard from being able to finish without an Initial Branch being set. However I'm confused about the functionality of the wizard. The SourceBranchPage specifically permits the case of importing a branchless-repo, via SourceBranchPage.java -> checkForEmptyRepo() method. If this method is removed from the validation logic, the user is notified of an invalid repo. This is where I think the wizard should stop, but cannot be sure if I'm missing some other functionality making this behavior desirable.
Created attachment 192912 [details] Clone Wizard: do not let a branchless repo be cloned. This patch prevents the CloneDestinationPage from being loaded if no source branch is selected on the SourceBranchPage. I'm not sure if this is a valid change, as the source indicates specifically that this is acceptable state (no source branch set).
I think that we should allow for cloning empty repositories. Native git also does that. I uploaded a fix for that to Gerrit: http://egit.eclipse.org/r/#change,3264. This would make http://egit.eclipse.org/r/#change,3163 and http://egit.eclipse.org/r/#change,3164 obsolete.
Merged with commit 2771482d4f9975442e4f35f83d1eea64cbd7951d
Sounds good to me Stephan!
*** Bug 343576 has been marked as a duplicate of this bug. ***