[JGIT PATCH] Egit move/delete bugfix, do not lose files when moving folders

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We lied to Eclipse in the move/delete hook and told it we had already
moved a folder. That wasn't true so the original was lost. With this
patch Eclipse will move the code for us, but it is not added to the index.

This is an intermediate fix until we actually manipulate the index properly.

Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---

 .../org/spearce/egit/core/GitMoveDeleteHook.java   |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --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
index 22a14c4..cc4059c 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitMoveDeleteHook.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitMoveDeleteHook.java
@@ -27,7 +27,6 @@ import org.spearce.jgit.lib.GitIndex;
 import org.spearce.jgit.lib.Repository;
 
 class GitMoveDeleteHook implements IMoveDeleteHook {
-	private static final boolean NOT_ALLOWED = true;
 	private static final boolean I_AM_DONE = true;
 
 	private static final boolean FINISH_FOR_ME = false;
@@ -54,7 +53,7 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 			e.printStackTrace();
 			tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0,
 					CoreText.MoveDeleteHook_operationError, e));
-			return NOT_ALLOWED;
+			return I_AM_DONE;
 		}
 	}
 
@@ -97,7 +96,7 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 				}
 				tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(),
 						0, "Destination not in a git versioned project", null));
-				return NOT_ALLOWED;
+				return FINISH_FOR_ME;
 			}
 			GitIndex index2 = map2.getRepository().getIndex();
 			tree.standardMoveFile(source, destination, updateFlags, monitor);
@@ -114,7 +113,7 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 			e.printStackTrace();
 			tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0,
 					CoreText.MoveDeleteHook_operationError, e));
-			return NOT_ALLOWED;
+			return I_AM_DONE;
 
 		}
 	}
@@ -124,25 +123,20 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 			final IProgressMonitor monitor) {
 		// TODO: Implement this. Should be relatively easy, but consider that
 		// Eclipse thinks folders are real thinsgs, while Git does not care.
-		return NOT_ALLOWED;
+		return FINISH_FOR_ME;
 	}
 
 	public boolean moveProject(final IResourceTree tree, final IProject source,
 			final IProjectDescription description, final int updateFlags,
 			final IProgressMonitor monitor) {
-		// Never allow moving a project as it can complicate updating our
-		// project data with the new repository mappings. To move a project
-		// disconnect the GIT team provider, move the project, then reconnect
-		// the GIT team provider.
-		// We should be able to do this without too much effort when the
+		// TODO: We should be able to do this without too much effort when the
 		// projects belong to the same Git repository.
-		//
-		return NOT_ALLOWED;
+		return FINISH_FOR_ME;
 	}
 
 	private boolean cannotModifyRepository(final IResourceTree tree) {
 		tree.failed(new Status(IStatus.ERROR, Activator.getPluginId(), 0,
 				CoreText.MoveDeleteHook_cannotModifyFolder, null));
-		return NOT_ALLOWED;
+		return I_AM_DONE;
 	}
 }
\ No newline at end of file
-- 
1.5.6.2.220.g44701
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux