git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
To: "'Shawn O. Pearce'" <spearce@spearce.org>
Cc: git@vger.kernel.org, "'Marek Zawirski'" <marek.zawirski@gmail.com>
Subject: [JGIT PATCH] Egit move/delete bugfix, do not lose files when moving folders
Date: Tue, 8 Jul 2008 23:51:47 +0200	[thread overview]
Message-ID: <200807082351.47636.robin.rosenberg.lists@dewire.com> (raw)

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@dewire.com>
---

 .../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

                 reply	other threads:[~2008-07-08 21:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200807082351.47636.robin.rosenberg.lists@dewire.com \
    --to=robin.rosenberg.lists@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=marek.zawirski@gmail.com \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).