Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354293 - dnd move causes loss of the entire dragged package
Summary: dnd move causes loss of the entire dragged package
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 critical with 1 vote (vote)
Target Milestone: 1.1-M2   Edit
Assignee: Stefan Lay CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-09 15:12 EDT by atkaaz CLA
Modified: 2011-08-17 06:36 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description atkaaz CLA 2011-08-09 15:12:16 EDT
Build Identifier: 1.1.0.201108090444

When drag-and-drop-ing (dnd) (aka move) a package to another project, and source project is on egit rcs, you will lose that package (ie. gets deleted and is not copied on destination).
  The destination project can (or not) be on egit too. The result is the same in both cases.

  Recovery: the package (when dirty) can be restored from eclipse Local History(right click, then Restore from Local History), or from previous commit (if not dirty)(right click, then Replace With->Commit). 


EGIT used(latest I from nightly I believe):
  Eclipse EGit	1.1.0.201108090444	org.eclipse.egit.feature.group	Eclipse EGit
    Eclipse JGit	1.1.0.201108052218	org.eclipse.jgit.feature.group	Eclipse JGit

Eclipse used:
Eclipse SDK
Version: 4.1.0
Build id: I20110805-1200

m2e and svn were also installed but likely have no effect.

Reproducible: Always

Steps to Reproduce:
1. make 2 projects, put one of them(the source project for the dnd) on egit
2. make a package with a java class
3. move that package to the second project's source folder via drag and drop
did you say goodbye to the package yet? no worries, Undo is disabled too ;)

Workaround 1: right click on project, Team->Disconnect
do the dnd
right click on project, Team->Share Project, choose Git, ->Next, 
tick [x] Use or create repository in parent folder of project
click Finish

Workaround 2: Ctrl+C (copy) on package, then Ctrl+V (paste) on second project's source folder. Then delete package in first project.
Note that Ctrl+X (cut) doesn't work - is disabled.
Comment 1 Remy Suen CLA 2011-08-10 09:02:29 EDT
I cannot seem to reproduce this 100% but seem to get it about half the time when I try it.
Comment 2 Remy Suen CLA 2011-08-13 18:03:16 EDT
This is caused by an incorrect implementation of the IMoveDeleteHook interface's moveFolder(*) method in EGit's GitMoveDeleteHook. The hook claims that it has successfully moved the folder (by returning 'true') but it actually only moves the folder if both the source and destination folders are in the same Git repository. JDT detects that the source folder still exists and proceeds to clean up the folder by deleting its content.
Comment 3 Stefan Lay CLA 2011-08-15 10:09:10 EDT
Fix proposed at http://egit.eclipse.org/r/4003