{"thread":{"id":"14354","subject":"[JGIT PATCH] Egit move/delete bugfix, do not lose files when moving folders","startedAt":"2008-07-08T21:51:47Z","lastAt":"2008-07-08T21:51:47Z","messageCount":1,"participants":["Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"82638","messageId":"200807082351.47636.robin.rosenberg.lists@dewire.com","threadId":"14354","inReplyTo":null,"subject":"[JGIT PATCH] Egit move/delete bugfix, do not lose files when moving folders","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-07-08T21:51:47Z","receivedAt":"2008-07-08T21:51:47Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"We lied to Eclipse in the move/delete hook and told it we had already\nmoved a folder. That wasn't true so the original was lost. With this\npatch Eclipse will move the code for us, but it is not added to the index.\n\nThis is an intermediate fix until we actually manipulate the index properly.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n\n .../org/spearce/egit/core/GitMoveDeleteHook.java   |   20 +++++++-------------\n 1 files changed, 7 insertions(+), 13 deletions(-)\n\ndiff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitMoveDeleteHook.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitMoveDeleteHook.java\nindex 22a14c4..cc4059c 100644\n--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitMoveDeleteHook.java\n+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitMoveDeleteHook.java\n@@ -27,7 +27,6 @@ import org.spearce.jgit.lib.GitIndex;\n import org.spearce.jgit.lib.Repository;\n \n class GitMoveDeleteHook implements IMoveDeleteHook {\n-\tprivate static final boolean NOT_ALLOWED = true;\n \tprivate static final boolean I_AM_DONE = true;\n \n \tprivate static final boolean FINISH_FOR_ME = false;\n@@ -54,7 +53,7 @@ class GitMoveDeleteHook implements IMoveDeleteHook {\n \t\t\te.printStackTrace();\n \t\t\ttree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0,\n \t\t\t\t\tCoreText.MoveDeleteHook_operationError, e));\n-\t\t\treturn NOT_ALLOWED;\n+\t\t\treturn I_AM_DONE;\n \t\t}\n \t}\n \n@@ -97,7 +96,7 @@ class GitMoveDeleteHook implements IMoveDeleteHook {\n \t\t\t\t}\n \t\t\t\ttree.failed(new Status(IStatus.ERROR, Activator.getPluginId(),\n \t\t\t\t\t\t0, \"Destination not in a git versioned project\", null));\n-\t\t\t\treturn NOT_ALLOWED;\n+\t\t\t\treturn FINISH_FOR_ME;\n \t\t\t}\n \t\t\tGitIndex index2 = map2.getRepository().getIndex();\n \t\t\ttree.standardMoveFile(source, destination, updateFlags, monitor);\n@@ -114,7 +113,7 @@ class GitMoveDeleteHook implements IMoveDeleteHook {\n \t\t\te.printStackTrace();\n \t\t\ttree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0,\n \t\t\t\t\tCoreText.MoveDeleteHook_operationError, e));\n-\t\t\treturn NOT_ALLOWED;\n+\t\t\treturn I_AM_DONE;\n \n \t\t}\n \t}\n@@ -124,25 +123,20 @@ class GitMoveDeleteHook implements IMoveDeleteHook {\n \t\t\tfinal IProgressMonitor monitor) {\n \t\t// TODO: Implement this. Should be relatively easy, but consider that\n \t\t// Eclipse thinks folders are real thinsgs, while Git does not care.\n-\t\treturn NOT_ALLOWED;\n+\t\treturn FINISH_FOR_ME;\n \t}\n \n \tpublic boolean moveProject(final IResourceTree tree, final IProject source,\n \t\t\tfinal IProjectDescription description, final int updateFlags,\n \t\t\tfinal IProgressMonitor monitor) {\n-\t\t// Never allow moving a project as it can complicate updating our\n-\t\t// project data with the new repository mappings. To move a project\n-\t\t// disconnect the GIT team provider, move the project, then reconnect\n-\t\t// the GIT team provider.\n-\t\t// We should be able to do this without too much effort when the\n+\t\t// TODO: We should be able to do this without too much effort when the\n \t\t// projects belong to the same Git repository.\n-\t\t//\n-\t\treturn NOT_ALLOWED;\n+\t\treturn FINISH_FOR_ME;\n \t}\n \n \tprivate boolean cannotModifyRepository(final IResourceTree tree) {\n \t\ttree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0,\n \t\t\t\tCoreText.MoveDeleteHook_cannotModifyFolder, null));\n-\t\treturn NOT_ALLOWED;\n+\t\treturn I_AM_DONE;\n \t}\n }\n\\ No newline at end of file\n-- \n1.5.6.2.220.g44701\n"}]}