Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342386 - Clone git repository fails silently when trying to clone from an empty remote repository.
Summary: Clone git repository fails silently when trying to clone from an empty remote...
Status: CLOSED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 343576 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-10 22:38 EDT by Ken Gilmer CLA
Modified: 2011-05-11 13:14 EDT (History)
3 users (show)

See Also:


Attachments
Clone Wizard: Don't allow wizard to finish if initial branch is not set in the UI. (1.18 KB, patch)
2011-04-10 22:49 EDT, Ken Gilmer CLA
no flags Details | Diff
Clone Wizard: do not let a branchless repo be cloned. (1.89 KB, patch)
2011-04-10 22:53 EDT, Ken Gilmer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Gilmer CLA 2011-04-10 22:38:22 EDT
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
Comment 1 Ken Gilmer CLA 2011-04-10 22:49:29 EDT
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.
Comment 2 Ken Gilmer CLA 2011-04-10 22:50:15 EDT
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.
Comment 3 Ken Gilmer CLA 2011-04-10 22:53:57 EDT
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).
Comment 4 Stefan Lay CLA 2011-04-27 09:51:35 EDT
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.
Comment 5 Dariusz Luksza CLA 2011-04-27 13:15:32 EDT
Merged with commit 2771482d4f9975442e4f35f83d1eea64cbd7951d
Comment 6 Ken Gilmer CLA 2011-04-27 20:36:48 EDT
Sounds good to me Stephan!
Comment 7 Kevin Sawicki CLA 2011-05-11 13:14:21 EDT
*** Bug 343576 has been marked as a duplicate of this bug. ***