rherrmann / gonsole

Gonsole - Git Console for the Eclipse IDE
http://gonsole.codeaffine.com
38 stars 10 forks source link

Checkout a branch with deleted project #75

Closed Waateur closed 6 years ago

Waateur commented 6 years ago

Hi

When i checkout a branch where a project is deleted, gonsole throw an exception.

Switched to branch 'master'
java.lang.RuntimeException: org.eclipse.core.internal.resources.ResourceException: Errors occurred while refreshing resources with the local file system.
    at com.codeaffine.gonsole.internal.interpreter.SharedResourcesRefresher.handleException(SharedResourcesRefresher.java:73)
    at com.codeaffine.gonsole.internal.interpreter.SharedResourcesRefresher.refreshSharedProjects(SharedResourcesRefresher.java:58)
    at com.codeaffine.gonsole.internal.interpreter.SharedResourcesRefresher.refresh(SharedResourcesRefresher.java:40)
    at com.codeaffine.gonsole.internal.interpreter.GitCommandInterpreter.refreshAffectedResources(GitCommandInterpreter.java:59)
    at com.codeaffine.gonsole.internal.interpreter.GitCommandInterpreter.execute(GitCommandInterpreter.java:40)
    at com.codeaffine.console.core.internal.ProcessorWorker.run(ProcessorWorker.java:45)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.core.internal.resources.ResourceException: Errors occurred while refreshing resources with the local file system.
    at org.eclipse.core.internal.localstore.FileSystemResourceManager.refreshResource(FileSystemResourceManager.java:974)
    at org.eclipse.core.internal.localstore.FileSystemResourceManager.refresh(FileSystemResourceManager.java:954)
    at org.eclipse.core.internal.resources.Resource.refreshLocal(Resource.java:1560)
    at com.codeaffine.gonsole.internal.interpreter.SharedResourcesRefresher$RefreshProjectsRunnable.run(SharedResourcesRefresher.java:95)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2240)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2267)
    at com.codeaffine.gonsole.internal.interpreter.SharedResourcesRefresher.refreshSharedProjects(SharedResourcesRefresher.java:56)
    ... 7 more

This is easy to reproduce make a simple workspace with 1 project and a java class. Create a new branch add a new project with a java class and switch from the new branch to master back and forth. Here is my setup : Ubuntu Bionic beaver Java : 1.8.0_171 Eclipse : Oxygen.3a Release (4.7.3a) Build id: 20180405-1200 gonsole 1.3.0.20171118-1911 ( from marketplace ) This issue can be an interesting to solve for gonsole as the same workflow is a real PITA with the native git when using eclipse.

rherrmann commented 6 years ago

Thank you for reporting this bug. We will look into it ASAP.

vibou commented 6 years ago

I am currently building an Eclipse plugin that watches for changes in any project's root locations. When event is triggered on a root location, the plugin automatically closes projects that are no longer in the root location and opens or import projects in the root location. All root locations are watched individually.

It implies to deactivate the option: Use File System Hook in Workspace settings for a better working. Let me know if you are interesting in it.

rherrmann commented 6 years ago

Commit 71a2188b412662b070a2c21811984f2ebf3bddb6 fixes the immediate issue: no exception is thrown anymore. The project from the previous branch, however, is still visible in the Package/Project Explorer but out of sync with the file system.

Since we know which Git commands modify the working tree and might delete or create projects, I think a proper solution that removes projects that are no longer backed by the file system would be useful here. Similarly, new projects could be added automatically to the workspace or a list of new projects with link to add them could be written to the output.

We've done that for another Git integration in Eclipse but I currently have no time to extract the code into a separate bundle and adapt it for Gonsole.

@vibou Thanks for your offer. However, I would prefer a solution that is tailored to Git/Gonsole, see my ideas outlined above. Furthermore, the file system hook is very popular and I would assume that most users wouldn't want to turn it off.

rherrmann commented 6 years ago

The build is currently failing (https://travis-ci.org/rherrmann/gonsole) for no obvious reason. Need more time to investigate. As soon as the build succeeds, a new version of Gonsole will be available from the repository.

rherrmann commented 6 years ago

The build finally succeeded, sorry for the delay, updates, as always, are available from http://rherrmann.github.io/gonsole/repository/. I consider this issue fixed. Please feel free to reopen if you have further problems.