git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [EGIT PATCH 0/4] Unit test for plugin and then some
@ 2007-04-22 21:35 Robin Rosenberg
  2007-04-22 21:35 ` [EGIT PATCH 1/4] Drop unneeded GitTreeStorage Robin Rosenberg
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Robin Rosenberg @ 2007-04-22 21:35 UTC (permalink / raw)
  To: spearce; +Cc: git

This adds a JUnit test for the plugin. It doesn't test much
yet, but rather than having more people add the infrastructure
I submit the skeleton and two small samples here. A writeRef
method is implemented to be able to set up the test repository
without using native Git. 

I also found an unneeded class when using Eclipse 3.3M6. Exterminated.

I also dropped the non-git sort order of trees.  This isn't too good looking, but
I expect it to be improved in later versions.

-- robin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [EGIT PATCH 1/4] Drop unneeded GitTreeStorage
  2007-04-22 21:35 [EGIT PATCH 0/4] Unit test for plugin and then some Robin Rosenberg
@ 2007-04-22 21:35 ` Robin Rosenberg
  2007-04-22 21:36 ` [EGIT PATCH 2/4] Use the Git sort order Robin Rosenberg
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Robin Rosenberg @ 2007-04-22 21:35 UTC (permalink / raw)
  To: spearce; +Cc: git

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

 .../src/org/spearce/egit/core/GitTreeStorage.java  |  484 -----------------------
 1 files changed, 0 insertions(+), 484 deletions(-)

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitTreeStorage.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitTreeStorage.java
deleted file mode 100644
index 044ea60..0000000
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitTreeStorage.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- *  Copyright (C) 2006  Robin Rosenberg
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License, version 2.1, as published by the Free Software Foundation.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
- */
-package org.spearce.egit.core;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourceAttributes;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.core.RepositoryProvider;
-import org.spearce.egit.core.project.RepositoryMapping;
-import org.spearce.jgit.lib.ObjectId;
-import org.spearce.jgit.lib.Tree;
-
-public class GitTreeStorage implements IContainer {
-
-	private Tree entry;
-
-	public GitTreeStorage(ObjectId treeId, IResource resource, String relativeResourceName) {
-		if (treeId == null)
-			return;
-
-		GitProvider provider = (GitProvider) RepositoryProvider
-				.getProvider(resource.getProject());
-		RepositoryMapping repositoryMapping = provider.getData()
-				.getRepositoryMapping(resource.getProject());
-		Tree tree;
-		try {
-			tree = repositoryMapping.getRepository().mapTree(treeId);
-			String prefix = repositoryMapping.getSubset();
-			if (prefix != null)
-				prefix = prefix + "/";
-			else
-				prefix = "";
-			String name = prefix + resource.getProjectRelativePath().toString();
-			entry = (Tree)tree.findMember(name);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	public boolean exists(IPath path) {
-		try {
-			return entry.findMember(path.toString()) != null;
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		return false;
-	}
-
-	public IFile[] findDeletedMembersWithHistory(int depth,
-			IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResource findMember(String name) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResource findMember(IPath path) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResource findMember(String name, boolean includePhantoms) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResource findMember(IPath path, boolean includePhantoms) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public String getDefaultCharset() throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public String getDefaultCharset(boolean checkImplicit) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IFile getFile(IPath path) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IFolder getFolder(IPath path) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResource[] members() throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResource[] members(boolean includePhantoms) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResource[] members(int memberFlags) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setDefaultCharset(String charset) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setDefaultCharset(String charset, IProgressMonitor monitor)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void accept(IResourceVisitor visitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void accept(IResourceProxyVisitor visitor, int memberFlags)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void accept(IResourceVisitor visitor, int depth,
-			boolean includePhantoms) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void accept(IResourceVisitor visitor, int depth, int memberFlags)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void clearHistory(IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void copy(IPath destination, boolean force, IProgressMonitor monitor)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void copy(IPath destination, int updateFlags,
-			IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void copy(IProjectDescription description, boolean force,
-			IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void copy(IProjectDescription description, int updateFlags,
-			IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public IMarker createMarker(String type) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IResourceProxy createProxy() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void delete(boolean force, IProgressMonitor monitor)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void delete(int updateFlags, IProgressMonitor monitor)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void deleteMarkers(String type, boolean includeSubtypes, int depth)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public boolean exists() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public IMarker findMarker(long id) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IMarker[] findMarkers(String type, boolean includeSubtypes, int depth)
-			throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public String getFileExtension() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IPath getFullPath() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public long getLocalTimeStamp() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	public IPath getLocation() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public URI getLocationURI() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IMarker getMarker(long id) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public long getModificationStamp() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IContainer getParent() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public String getPersistentProperty(QualifiedName key) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IProject getProject() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IPath getProjectRelativePath() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public IPath getRawLocation() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public URI getRawLocationURI() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public ResourceAttributes getResourceAttributes() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Object getSessionProperty(QualifiedName key) throws CoreException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public int getType() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	public IWorkspace getWorkspace() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public boolean isAccessible() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isDerived() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isLinked() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isLinked(int options) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isLocal(int depth) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isPhantom() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isReadOnly() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isSynchronized(int depth) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isTeamPrivateMember() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public void move(IPath destination, boolean force, IProgressMonitor monitor)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void move(IPath destination, int updateFlags,
-			IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void move(IProjectDescription description, int updateFlags,
-			IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void move(IProjectDescription description, boolean force,
-			boolean keepHistory, IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void refreshLocal(int depth, IProgressMonitor monitor)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void revertModificationStamp(long value) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setDerived(boolean isDerived) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setLocal(boolean flag, int depth, IProgressMonitor monitor)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public long setLocalTimeStamp(long value) throws CoreException {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	public void setPersistentProperty(QualifiedName key, String value)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setReadOnly(boolean readOnly) {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setResourceAttributes(ResourceAttributes attributes)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setSessionProperty(QualifiedName key, Object value)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setTeamPrivateMember(boolean isTeamPrivate)
-			throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void touch(IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	public Object getAdapter(Class adapter) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public boolean contains(ISchedulingRule rule) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean isConflicting(ISchedulingRule rule) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-}

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [EGIT PATCH 2/4] Use the Git sort order.
  2007-04-22 21:35 [EGIT PATCH 0/4] Unit test for plugin and then some Robin Rosenberg
  2007-04-22 21:35 ` [EGIT PATCH 1/4] Drop unneeded GitTreeStorage Robin Rosenberg
@ 2007-04-22 21:36 ` Robin Rosenberg
  2007-04-23 22:39   ` Robin Rosenberg
  2007-04-22 21:36 ` [EGIT PATCH 3/4] Add writeRef method and make writeSymref public Robin Rosenberg
  2007-04-22 21:36 ` [EGIT PATCH 4/4] Add a JUnit test project for egit Robin Rosenberg
  3 siblings, 1 reply; 8+ messages in thread
From: Robin Rosenberg @ 2007-04-22 21:36 UTC (permalink / raw)
  To: spearce; +Cc: git

Do not resort trees when reading into memory. This requires
that a number of routines learn to sort tree
entries as if they end with a '/'. To do that a parameter
must be passed. I do this by passing a NUL or '/' byte as
an extra parameter for the comparison routines.

No noticeable performance difference can be noted. The reason
for this patch is to simply implementation of the git index
and make jgit more git-like.

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

 .../src/org/spearce/egit/core/GitBlobStorage.java  |    2 -
 .../org/spearce/egit/core/GitMoveDeleteHook.java   |   17 ++++-
 .../src/org/spearce/egit/core/GitStorage.java      |    5 +
 .../egit/core/internal/mapping/GitFileHistory.java |   11 ++-
 .../core/internal/mapping/GitFileRevision.java     |    5 +
 .../org/spearce/egit/core/op/TrackOperation.java   |    8 +-
 .../org/spearce/egit/core/op/UntrackOperation.java |    6 +-
 .../spearce/egit/core/project/GitProjectData.java  |   10 ++-
 .../egit/core/project/RepositoryMapping.java       |    2 -
 .../org.spearce.jgit--All-Tests.launch             |    6 ++
 .../src/org/spearce/jgit/lib/MergedTree.java       |   27 +++++--
 .../src/org/spearce/jgit/lib/ObjectWriter.java     |    7 --
 .../src/org/spearce/jgit/lib/SubtreeSorter.java    |   40 -----------
 .../src/org/spearce/jgit/lib/Tree.java             |   85 ++++++++++++++++-------
 .../src/org/spearce/jgit/lib/TreeEntry.java        |    9 ++
 .../tst/org/spearce/jgit/lib/T0002_Tree.java       |   33 +++++----
 .../org/spearce/jgit/lib/T0006_DeepSpeedTest.java  |    2 -
 17 files changed, 160 insertions(+), 115 deletions(-)

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java
index c947e2b..3ab2184 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitBlobStorage.java
@@ -59,7 +59,7 @@ public class GitBlobStorage implements IStorage {
 			else
 				prefix = "";
 			String name = prefix + resource.getProjectRelativePath().toString();
-			entry = tree.findMember(name);
+			entry = tree.findBlobMember(name);
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
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 e09ac76..389fc76 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
@@ -122,7 +122,7 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 
 		if (s != null && m != null && m.getCacheTree() != null) {
 			try {
-				final TreeEntry e = m.getCacheTree().findMember(s);
+				final TreeEntry e = m.getCacheTree().findTreeMember(s);
 				if (e != null) {
 					e.delete();
 					m.recomputeMerge();
@@ -182,7 +182,10 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 		}
 
 		try {
-			srcEnt = srcMap.getCacheTree().findMember(srcPath);
+			if (src.getType() == IResource.FILE)
+				srcEnt = srcMap.getCacheTree().findBlobMember(srcPath);
+			else
+				srcEnt = srcMap.getCacheTree().findTreeMember(srcPath);
 			if (srcEnt == null) {
 				return FINISH_FOR_ME;
 			}
@@ -199,7 +202,11 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 			if (dstPath == null) {
 				dstTree = dstMap.getCacheTree();
 			} else {
-				final TreeEntry e = dstMap.getCacheTree().findMember(dstPath);
+				final TreeEntry e;
+				if (src.getType() == IResource.FILE)
+					e = dstMap.getCacheTree().findBlobMember(dstPath);
+				else
+					e = dstMap.getCacheTree().findTreeMember(dstPath);
 				if (e == null) {
 					dstTree = dstMap.getCacheTree().addTree(dstPath);
 				} else if (e instanceof Tree) {
@@ -216,7 +223,9 @@ class GitMoveDeleteHook implements IMoveDeleteHook {
 			// What? Something already exists at the destination? Assume
 			// Eclipse meant for us to replace the item.
 			//
-			final TreeEntry existing = dstTree.findMember(dstName);
+			TreeEntry existing = dstTree.findTreeMember(dstName);
+			if (existing == null)
+				dstTree.findBlobMember(dstName);
 			if (existing != null) {
 				existing.delete();
 			}
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java b/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java
index ce4ff71..edef5db 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/GitStorage.java
@@ -62,7 +62,10 @@ public class GitStorage implements IStorage {
 			else
 				prefix = "";
 			String name = prefix + resource.getProjectRelativePath().toString();
-			entry = tree.findMember(name);
+			if (resource.getType() == IResource.FILE)
+				entry = tree.findBlobMember(name);
+			else
+				entry = tree.findTreeMember(name);
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java
index 51109fb..0569862 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileHistory.java
@@ -147,7 +147,11 @@ public class GitFileHistory extends FileHistory implements IAdaptable {
 			ObjectId[] currentResourceHash = new ObjectId[lastResourceHash.length];
 			Tree t = current.getTree();
 			for (int i = 0; i < currentResourceHash.length; ++i) {
-				TreeEntry m = t.findMember(relativeResourceName[i]);
+				TreeEntry m;
+				if (i == relativeResourceName.length-1 && resource.getType() == IResource.FILE)
+					m = t.findBlobMember(relativeResourceName[i]);
+				else
+					m = t.findTreeMember(relativeResourceName[i]);
 				if (m != null) {
 					ObjectId id = m.getId();
 					currentResourceHash[i] = id;
@@ -251,7 +255,10 @@ public class GitFileHistory extends FileHistory implements IAdaptable {
 			}
 			TreeEntry currentEntry = current.getTree();
 			for (int i=0; i < relativeResourceName.length && currentEntry != null; ++i) {
-				((Tree)currentEntry).findMember(relativeResourceName[i]);
+				if (i == relativeResourceName.length-1 && resource.getType() == IResource.FILE)
+					((Tree)currentEntry).findBlobMember(relativeResourceName[i]);
+				else
+					((Tree)currentEntry).findTreeMember(relativeResourceName[i]);
 			}
 			if (currentEntry != null)
 				revisions = new IFileRevision[] { new GitFileRevision(current, resource,
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java
index def142f..63d8486 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/internal/mapping/GitFileRevision.java
@@ -156,7 +156,10 @@ public class GitFileRevision extends FileRevision {
 				else {
 					prefix = prefix + "/";
 					String name = prefix + relPath;
-					return tree.findMember(name);
+					if (resource.getType() == IResource.FILE)
+						return tree.findBlobMember(name);
+					else
+						return tree.findTreeMember(name);
 				}
 			} else
 				return tree;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java
index 2f4488d..df3dba7 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/TrackOperation.java
@@ -137,12 +137,14 @@ public class TrackOperation implements IWorkspaceRunnable {
 			// Uh, what? Why are we adding a phantom resource? Just say no!
 			//
 		} else if (toAdd instanceof IFile) {
-			if (!t.exists(path)) {
-				t.addFile(path);
+			if (!t.existsTree(path)) {
+				if (!t.existsBlob(path)) {				
+					t.addFile(path);
+				}
 			}
 		} else if (toAdd instanceof IContainer) {
 			final IResource[] m = ((IContainer) toAdd).members();
-			final TreeEntry e = t.findMember(path);
+			final TreeEntry e = t.findTreeMember(path);
 			final Tree c;
 			c = e instanceof Tree ? (Tree) e : e == null ? t.addTree(path)
 					: null;
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/UntrackOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/UntrackOperation.java
index 1a81192..d477644 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/UntrackOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/UntrackOperation.java
@@ -120,7 +120,11 @@ public class UntrackOperation implements IWorkspaceRunnable {
 
 		try {
 			final Tree t = m.getCacheTree();
-			final TreeEntry e = t.findMember(s);
+			final TreeEntry e;
+			if (torm.getType() == IResource.FILE)
+				e = t.findBlobMember(s);
+			else
+				e = t.findTreeMember(s);
 			if (e != null) {
 				e.delete();
 				tomerge.put(m, m);
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
index 10cc3a0..0c4683e 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
@@ -296,7 +296,10 @@ public class GitProjectData {
 
 		if (s != null && m != null && m.getActiveDiff() != null) {
 			try {
-				return m.getActiveDiff().findMember(s);
+				if (r.getType() == IResource.FILE)
+					return m.getActiveDiff().findBlobMember(s);
+				else
+					return m.getActiveDiff().findTreeMember(s);
 			} catch (IOException ioe) {
 				throw Activator.error(
 						CoreText.GitProjectData_lazyResolveFailed, ioe);
@@ -416,7 +419,10 @@ public class GitProjectData {
 							try {
 								synchronized (cacheTree) {
 									final TreeEntry e;
-									e = cacheTree.findMember(s);
+									if (r.getType() == IResource.FILE)
+										e = cacheTree.findBlobMember(s);
+									else
+										e = cacheTree.findTreeMember(s);
 									if (e instanceof FileTreeEntry) {
 										trace("modified " + r + " -> "
 												+ e.getFullName());
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
index df10665..6b9beed 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/RepositoryMapping.java
@@ -210,7 +210,7 @@ public class RepositoryMapping {
 		Tree head = getRepository().mapTree(Constants.HEAD);
 		if (head != null) {
 			if (getSubset() != null) {
-				final TreeEntry e = head.findMember(getSubset());
+				final TreeEntry e = head.findTreeMember(getSubset());
 				e.detachParent();
 				head = e instanceof Tree ? (Tree) e : null;
 			}
diff --git a/org.spearce.jgit/org.spearce.jgit--All-Tests.launch b/org.spearce.jgit/org.spearce.jgit--All-Tests.launch
index bdbfdea..0ff3d23 100644
--- a/org.spearce.jgit/org.spearce.jgit--All-Tests.launch
+++ b/org.spearce.jgit/org.spearce.jgit--All-Tests.launch
@@ -3,11 +3,17 @@
 <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
 <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.spearce.jgit"/>
 <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
 <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
 <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
 </listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.spearce.jgit"/>
+</listAttribute>
 <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.spearce.jgit"/>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/MergedTree.java b/org.spearce.jgit/src/org/spearce/jgit/lib/MergedTree.java
index e5b2967..165adc3 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/MergedTree.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/MergedTree.java
@@ -53,7 +53,7 @@ public class MergedTree {
 	}
 
 	private static final int binarySearch(final TreeEntry[] entries,
-			final int width, final byte[] nameUTF8, final int nameStart,
+			final int width, final byte[] nameUTF8, final byte nameUTF8last, final int nameStart,
 			final int nameEnd) {
 		if (entries.length == 0)
 			return -1;
@@ -66,7 +66,7 @@ public class MergedTree {
 			while (entries[ix] == null)
 				ix++;
 			cmp = Tree.compareNames(entries[ix].getNameUTF8(), nameUTF8,
-					nameStart, nameEnd);
+					nameStart, nameEnd, TreeEntry.lastChar(entries[ix]), nameUTF8last);
 			if (cmp < 0)
 				low = mid + 1;
 			else if (cmp == 0)
@@ -95,11 +95,11 @@ public class MergedTree {
 		return isModified(sources);
 	}
 
-	public TreeEntry[] findMember(final String s) throws IOException {
-		return findMember(s.getBytes(Constants.CHARACTER_ENCODING), 0);
+	public TreeEntry[] findMember(final String s, final byte slast) throws IOException {
+		return findMember(s.getBytes(Constants.CHARACTER_ENCODING), slast, 0);
 	}
 
-	public TreeEntry[] findMember(final byte[] s, final int offset)
+	public TreeEntry[] findMember(final byte[] s, final byte slast, final int offset)
 			throws IOException {
 		final int srcCnt = sources.length;
 		int slash;
@@ -108,7 +108,8 @@ public class MergedTree {
 		for (slash = offset; slash < s.length && s[slash] != '/'; slash++) {
 			// search for path component terminator
 		}
-		p = binarySearch(merged, srcCnt, s, offset, slash);
+		byte xlast = slash<s.length ? (byte)'/' : slast;
+		p = binarySearch(merged, srcCnt, s, xlast, offset, slash);
 		if (p < 0)
 			return null;
 
@@ -127,7 +128,15 @@ public class MergedTree {
 				subs[j] = merged[k] instanceof Tree ? (Tree) merged[k] : null;
 			subtrees[p] = new MergedTree(subs);
 		}
-		return subtrees[p].findMember(s, slash + 1);
+		return subtrees[p].findMember(s, slast, slash + 1);
+	}
+
+	public TreeEntry[] findBlobMember(String s) throws IOException {
+		return findMember(s,(byte)0);
+	}
+
+	public TreeEntry[] findTreeMember(String s) throws IOException {
+		return findMember(s,(byte)'/');
 	}
 
 	private void matchByName() throws IOException {
@@ -160,6 +169,7 @@ public class MergedTree {
 		newMerged = new TreeEntry[pos * srcCnt];
 		for (pos = 0, treeId = 0; done < srcCnt; pos += srcCnt, treeId++) {
 			byte[] minName = null;
+			int minNameLast = 0;
 
 			if ((pos + srcCnt) >= newMerged.length) {
 				final TreeEntry[] t = new TreeEntry[newMerged.length * 2];
@@ -176,10 +186,11 @@ public class MergedTree {
 
 				final TreeEntry thisEntry = ents[ti];
 				final int cmp = minName == null ? -1 : Tree.compareNames(
-						thisEntry.getNameUTF8(), minName);
+						thisEntry.getNameUTF8(), minName, TreeEntry.lastChar(thisEntry), minNameLast);
 
 				if (cmp < 0) {
 					minName = thisEntry.getNameUTF8();
+					minNameLast = TreeEntry.lastChar(thisEntry);
 					for (int j = srcId - 1; j >= 0; j--) {
 						if (newMerged[pos + j] != null) {
 							newMerged[pos + j] = null;
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
index 5722eec..f9f2bde 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectWriter.java
@@ -25,7 +25,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStreamWriter;
 import java.security.MessageDigest;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.zip.Deflater;
 import java.util.zip.DeflaterOutputStream;
@@ -82,12 +81,6 @@ public class ObjectWriter {
 	public ObjectId writeTree(final Tree t) throws IOException {
 		final ByteArrayOutputStream o = new ByteArrayOutputStream();
 		final TreeEntry[] items = t.members();
-		for (int k = items.length - 1; k >= 0; k--) {
-			if (items[k] instanceof Tree) {
-				Arrays.sort(items, SubtreeSorter.INSTANCE);
-				break;
-			}
-		}
 		for (int k = 0; k < items.length; k++) {
 			final TreeEntry e = items[k];
 			final ObjectId id = e.getId();
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/SubtreeSorter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/SubtreeSorter.java
deleted file mode 100644
index 2557525..0000000
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/SubtreeSorter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.spearce.jgit.lib;
-
-import java.util.Comparator;
-
-public class SubtreeSorter implements Comparator {
-	public static final SubtreeSorter INSTANCE = new SubtreeSorter();
-
-	public int compare(final Object o1, final Object o2) {
-		final TreeEntry a = (TreeEntry) o1;
-		final TreeEntry b = (TreeEntry) o2;
-		final byte[] aName = a.getNameUTF8();
-		final byte[] bName = b.getNameUTF8();
-
-		for (int k = 0; k < aName.length && k < bName.length; k++) {
-			if (aName[k] < bName[k])
-				return -1;
-			else if (aName[k] > bName[k])
-				return 1;
-		}
-
-		if (aName.length < bName.length) {
-			if (a instanceof Tree && '/' > bName[aName.length])
-				return 1;
-			return -1;
-		} else if (aName.length == bName.length) {
-			if (a instanceof Tree && b instanceof Tree)
-				return 0;
-			else if (a instanceof Tree)
-				return 1;
-			else if (b instanceof Tree)
-				return -1;
-			else
-				return 0;
-		} else {
-			if (b instanceof Tree && aName[bName.length] < '/')
-				return -1;
-			return 1;
-		}
-	}
-}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java
index 65ed400..73a5e2c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Tree.java
@@ -17,7 +17,6 @@
 package org.spearce.jgit.lib;
 
 import java.io.IOException;
-import java.util.Arrays;
 
 import org.spearce.jgit.errors.CorruptObjectException;
 import org.spearce.jgit.errors.EntryExistsException;
@@ -26,13 +25,14 @@ import org.spearce.jgit.errors.MissingObjectException;
 public class Tree extends TreeEntry implements Treeish {
 	public static final TreeEntry[] EMPTY_TREE = {};
 
-	public static final int compareNames(final byte[] a, final byte[] b) {
-		return compareNames(a, b, 0, b.length);
+	public static final int compareNames(final byte[] a, final byte[] b, final int lasta,final int lastb) {
+		return compareNames(a, b, 0, b.length, lasta, lastb);
 	}
 
 	public static final int compareNames(final byte[] a, final byte[] nameUTF8,
-			final int nameStart, final int nameEnd) {
-		for (int j = 0, k = nameStart; j < a.length && k < nameEnd; j++, k++) {
+			final int nameStart, final int nameEnd, final int lasta, int lastb) {
+		int j,k;
+		for (j = 0, k = nameStart; j < a.length && k < nameEnd; j++, k++) {
 			final int aj = a[j] & 0xff;
 			final int bk = nameUTF8[k] & 0xff;
 			if (aj < bk)
@@ -40,6 +40,28 @@ public class Tree extends TreeEntry implements Treeish {
 			else if (aj > bk)
 				return 1;
 		}
+		if (j < a.length) {
+			int aj = a[j]&0xff;
+			if (aj < lastb)
+				return -1;
+			else if (aj > lastb)
+				return 1;
+			else
+				return 0;
+		}
+		if (k < nameEnd) {
+			int bk = nameUTF8[k] & 0xff;
+			if (lasta < bk)
+				return -1;
+			else if (lasta > bk)
+				return 1;
+			else
+				return 0;
+		}
+		if (lasta < lastb)
+			return -1;
+		else if (lasta > lastb)
+			return 1;
 
 		final int namelength = nameEnd - nameStart;
 		if (a.length == namelength)
@@ -60,7 +82,7 @@ public class Tree extends TreeEntry implements Treeish {
 	}
 
 	private static final int binarySearch(final TreeEntry[] entries,
-			final byte[] nameUTF8, final int nameStart, final int nameEnd) {
+			final byte[] nameUTF8, final int nameUTF8last, final int nameStart, final int nameEnd) {
 		if (entries.length == 0)
 			return -1;
 		int high = entries.length;
@@ -68,7 +90,7 @@ public class Tree extends TreeEntry implements Treeish {
 		do {
 			final int mid = (low + high) / 2;
 			final int cmp = compareNames(entries[mid].getNameUTF8(), nameUTF8,
-					nameStart, nameEnd);
+					nameStart, nameEnd, TreeEntry.lastChar(entries[mid]), nameUTF8last);
 			if (cmp < 0)
 				low = mid + 1;
 			else if (cmp == 0)
@@ -151,7 +173,8 @@ public class Tree extends TreeEntry implements Treeish {
 		}
 
 		ensureLoaded();
-		p = binarySearch(contents, s, offset, slash);
+		byte xlast = slash<s.length ? (byte)'/' : 0;
+		p = binarySearch(contents, s, xlast, offset, slash);
 		if (p >= 0 && slash < s.length && contents[p] instanceof Tree)
 			return ((Tree) contents[p]).addFile(s, slash + 1);
 
@@ -184,7 +207,7 @@ public class Tree extends TreeEntry implements Treeish {
 		}
 
 		ensureLoaded();
-		p = binarySearch(contents, s, offset, slash);
+		p = binarySearch(contents, s, (byte)'/', offset, slash);
 		if (p >= 0 && slash < s.length && contents[p] instanceof Tree)
 			return ((Tree) contents[p]).addTree(s, slash + 1);
 
@@ -202,7 +225,7 @@ public class Tree extends TreeEntry implements Treeish {
 		final int p;
 
 		ensureLoaded();
-		p = binarySearch(contents, e.getNameUTF8(), 0, e.getNameUTF8().length);
+		p = binarySearch(contents, e.getNameUTF8(), TreeEntry.lastChar(e), 0, e.getNameUTF8().length);
 		if (p < 0) {
 			e.attachParent(this);
 			insertEntry(p, e);
@@ -227,7 +250,7 @@ public class Tree extends TreeEntry implements Treeish {
 
 	void removeEntry(final TreeEntry e) {
 		final TreeEntry[] c = contents;
-		final int p = binarySearch(c, e.getNameUTF8(), 0,
+		final int p = binarySearch(c, e.getNameUTF8(), TreeEntry.lastChar(e), 0,
 				e.getNameUTF8().length);
 		if (p >= 0) {
 			final TreeEntry[] n = new TreeEntry[c.length - 1];
@@ -257,15 +280,23 @@ public class Tree extends TreeEntry implements Treeish {
 			return c;
 	}
 
-	public boolean exists(final String s) throws IOException {
-		return findMember(s) != null;
+	public boolean exists(final String s, byte slast) throws IOException {
+		return findMember(s, slast) != null;
 	}
 
-	public TreeEntry findMember(final String s) throws IOException {
-		return findMember(s.getBytes(Constants.CHARACTER_ENCODING), 0);
+	public boolean existsTree(String path) throws IOException {
+		return exists(path,(byte)'/');
 	}
 
-	public TreeEntry findMember(final byte[] s, final int offset)
+	public boolean existsBlob(String path) throws IOException {
+		return exists(path,(byte)0);
+	}
+
+	public TreeEntry findMember(final String s, byte slast) throws IOException {
+		return findMember(s.getBytes(Constants.CHARACTER_ENCODING), slast, 0);
+	}
+
+	public TreeEntry findMember(final byte[] s, final byte slast, final int offset)
 			throws IOException {
 		int slash;
 		int p;
@@ -275,17 +306,26 @@ public class Tree extends TreeEntry implements Treeish {
 		}
 
 		ensureLoaded();
-		p = binarySearch(contents, s, offset, slash);
+		byte xlast = slash<s.length ? (byte)'/' : slast;
+		p = binarySearch(contents, s, xlast, offset, slash);
 		if (p >= 0) {
 			final TreeEntry r = contents[p];
 			if (slash < s.length)
-				return r instanceof Tree ? ((Tree) r).findMember(s, slash + 1)
+				return r instanceof Tree ? ((Tree) r).findMember(s, slast, slash + 1)
 						: null;
 			return r;
 		}
 		return null;
 	}
 
+	public TreeEntry findBlobMember(String s) throws IOException {
+		return findMember(s,(byte)0);
+	}
+
+	public TreeEntry findTreeMember(String s) throws IOException {
+		return findMember(s,(byte)'/');
+	}
+
 	public void accept(final TreeVisitor tv, final int flags)
 			throws IOException {
 		final TreeEntry[] c;
@@ -326,7 +366,6 @@ public class Tree extends TreeEntry implements Treeish {
 		int rawPtr = 0;
 		TreeEntry[] temp = new TreeEntry[64];
 		int nextIndex = 0;
-		boolean resort = false;
 
 		while (rawPtr < raw.length) {
 			int c = raw[rawPtr++] & 0xff;
@@ -362,7 +401,6 @@ public class Tree extends TreeEntry implements Treeish {
 				ent = new FileTreeEntry(this, id, name, true);
 			else if (FileMode.TREE.equals(mode)) {
 				ent = new Tree(this, id, name);
-				resort = true;
 			} else if (FileMode.SYMLINK.equals(mode))
 				ent = new SymlinkTreeEntry(this, id, name);
 			else
@@ -388,12 +426,6 @@ public class Tree extends TreeEntry implements Treeish {
 			contents = n;
 		}
 
-		// Resort contents using our internal sorting order. Git sorts
-		// subtrees as though their names end in '/' but that's not how
-		// we sort them in memory. Its all the fault of the index...
-		//
-		if (resort)
-			Arrays.sort(contents);
 	}
 
 	public String toString() {
@@ -403,4 +435,5 @@ public class Tree extends TreeEntry implements Treeish {
 		r.append(getFullName());
 		return r.toString();
 	}
+
 }
\ No newline at end of file
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java
index 084a9f3..1219846 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeEntry.java
@@ -126,10 +126,17 @@ public abstract class TreeEntry implements Comparable {
 		if (this == o)
 			return 0;
 		if (o instanceof TreeEntry)
-			return Tree.compareNames(nameUTF8, ((TreeEntry) o).nameUTF8);
+			return Tree.compareNames(nameUTF8, ((TreeEntry) o).nameUTF8, lastChar(this), lastChar((TreeEntry)o));
 		return -1;
 	}
 
+	final public static int lastChar(TreeEntry treeEntry) {
+		if (treeEntry instanceof FileTreeEntry)
+			return '\0';
+		else
+			return '/';
+	}
+
 	public void accept(final TreeVisitor tv) throws IOException {
 		accept(tv, 0);
 	}
diff --git a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0002_Tree.java b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0002_Tree.java
index e757ef8..62df113 100644
--- a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0002_Tree.java
+++ b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0002_Tree.java
@@ -38,7 +38,8 @@ public class T0002_Tree extends RepositoryTestCase {
 		assertTrue("no id", t.getId() == null);
 		assertTrue("tree is self", t.getTree() == t);
 		assertTrue("database is r", t.getRepository() == db);
-		assertTrue("no foo child", t.findMember("foo") == null);
+		assertTrue("no foo child", t.findTreeMember("foo") == null);
+		assertTrue("no foo child", t.findBlobMember("foo") == null);
 	}
 
 	public void test002_addFile() throws IOException {
@@ -57,7 +58,7 @@ public class T0002_Tree extends RepositoryTestCase {
 		assertTrue("no id", f.getId() == null);
 		assertTrue("is modified", t.isModified());
 		assertTrue("has no id", t.getId() == null);
-		assertTrue("found bob", t.findMember(f.getName()) == f);
+		assertTrue("found bob", t.findBlobMember(f.getName()) == f);
 
 		final TreeEntry[] i = t.members();
 		assertTrue("iterator is not empty", i != null && i.length > 0);
@@ -87,7 +88,7 @@ public class T0002_Tree extends RepositoryTestCase {
 		assertTrue("tree is self", f.getTree() == f);
 		assertTrue("parent is modified", t.isModified());
 		assertTrue("parent has no id", t.getId() == null);
-		assertTrue("found bob child", t.findMember(f.getName()) == f);
+		assertTrue("found bob child", t.findTreeMember(f.getName()) == f);
 
 		final TreeEntry[] i = t.members();
 		assertTrue("iterator is not empty", i.length > 0);
@@ -145,14 +146,14 @@ public class T0002_Tree extends RepositoryTestCase {
 		assertTrue("t not modified.", !t.isModified());
 
 		assertEquals("full path of h ok", "f/g/h", h.getFullName());
-		assertTrue("Can find h", t.findMember(h.getFullName()) == h);
-		assertTrue("Can't find f/z", t.findMember("f/z") == null);
-		assertTrue("Can't find y/z", t.findMember("y/z") == null);
+		assertTrue("Can find h", t.findTreeMember(h.getFullName()) == h);
+		assertTrue("Can't find f/z", t.findBlobMember("f/z") == null);
+		assertTrue("Can't find y/z", t.findBlobMember("y/z") == null);
 
 		final FileTreeEntry i = h.addFile("i");
 		assertNotNull(i);
 		assertEquals("full path of i ok", "f/g/h/i", i.getFullName());
-		assertTrue("Can find i", t.findMember(i.getFullName()) == i);
+		assertTrue("Can find i", t.findBlobMember(i.getFullName()) == i);
 		assertTrue("h modified", h.isModified());
 		assertTrue("g modified", g.isModified());
 		assertTrue("f modified", f.isModified());
@@ -190,17 +191,17 @@ public class T0002_Tree extends RepositoryTestCase {
 
 	public void test008_SubtreeInternalSorting() throws IOException {
 		final Tree t = new Tree(db);
-		final FileTreeEntry e0 = t.addFile("a-");
-		final FileTreeEntry e1 = t.addFile("a-b");
-		final Tree e2 = t.addTree("a");
-		final FileTreeEntry e3 = t.addFile("a=");
-		final FileTreeEntry e4 = t.addFile("a=b");
+		final FileTreeEntry e0 = t.addFile("a-b");
+		final FileTreeEntry e1 = t.addFile("a-");
+		final FileTreeEntry e2 = t.addFile("a=b");
+		final Tree e3 = t.addTree("a");
+		final FileTreeEntry e4 = t.addFile("a=");
 
 		final TreeEntry[] ents = t.members();
-		assertSame(e2, ents[0]);
+		assertSame(e1, ents[0]);
 		assertSame(e0, ents[1]);
-		assertSame(e1, ents[2]);
-		assertSame(e3, ents[3]);
-		assertSame(e4, ents[4]);
+		assertSame(e3, ents[2]);
+		assertSame(e4, ents[3]);
+		assertSame(e2, ents[4]);
 	}
 }
diff --git a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0006_DeepSpeedTest.java b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0006_DeepSpeedTest.java
index 2ae9d42..b4ae4b8 100644
--- a/org.spearce.jgit/tst/org/spearce/jgit/lib/T0006_DeepSpeedTest.java
+++ b/org.spearce.jgit/tst/org/spearce/jgit/lib/T0006_DeepSpeedTest.java
@@ -39,7 +39,7 @@ public class T0006_DeepSpeedTest extends SpeedTestBase {
 			if (parent.size() > 0) {
 				ObjectId parentId = (ObjectId) parent.get(0);
 				commit = db.mapCommit(parentId);
-				TreeEntry m = commit.getTree().findMember("net/netfilter/nf_queue.c");
+				TreeEntry m = commit.getTree().findBlobMember("net/netfilter/nf_queue.c");
 				if (m != null)
 					commit.getCommitId().toString();
 				++n;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [EGIT PATCH 3/4] Add writeRef method and make writeSymref public.
  2007-04-22 21:35 [EGIT PATCH 0/4] Unit test for plugin and then some Robin Rosenberg
  2007-04-22 21:35 ` [EGIT PATCH 1/4] Drop unneeded GitTreeStorage Robin Rosenberg
  2007-04-22 21:36 ` [EGIT PATCH 2/4] Use the Git sort order Robin Rosenberg
@ 2007-04-22 21:36 ` Robin Rosenberg
  2007-04-22 21:36 ` [EGIT PATCH 4/4] Add a JUnit test project for egit Robin Rosenberg
  3 siblings, 0 replies; 8+ messages in thread
From: Robin Rosenberg @ 2007-04-22 21:36 UTC (permalink / raw)
  To: spearce; +Cc: git

The writeRef method is for creating tags and branches. writeSymref
is for creating symbols like HEAD.

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

 .../src/org/spearce/jgit/lib/Repository.java       |   31 ++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index b4d6473..0f2a900 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -349,7 +349,36 @@ public class Repository {
 		}
 	}
 
-	private void writeSymref(final String name, final String target)
+    public void writeRef(String name, ObjectId id) throws IOException {
+		File f = new File(gitDir, name);
+		File t = File.createTempFile("ref", null, gitDir);
+		FileWriter w = new FileWriter(t);
+		try {
+			w.write(id.toString());
+			w.write('\n');
+			w.close();
+			w = null;
+			if (!t.renameTo(f)) {
+				f.getParentFile().mkdirs();
+				if (!t.renameTo(f)) {
+					f.delete();
+					if (!t.renameTo(f)) {
+						t.delete();
+						throw new ObjectWritingException("Unable to"
+								+ " write ref " + name + " to point to "
+								+ id.toString());
+					}
+				}
+			}
+		} finally {
+			if (w != null) {
+				w.close();
+				t.delete();
+			}
+		}
+	}
+
+    public void writeSymref(final String name, final String target)
 			throws IOException {
 		final File s = new File(gitDir, name);
 		final File t = File.createTempFile("srf", null, gitDir);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [EGIT PATCH 4/4] Add a JUnit test project for egit.
  2007-04-22 21:35 [EGIT PATCH 0/4] Unit test for plugin and then some Robin Rosenberg
                   ` (2 preceding siblings ...)
  2007-04-22 21:36 ` [EGIT PATCH 3/4] Add writeRef method and make writeSymref public Robin Rosenberg
@ 2007-04-22 21:36 ` Robin Rosenberg
  2007-04-23 22:41   ` Robin Rosenberg
  3 siblings, 1 reply; 8+ messages in thread
From: Robin Rosenberg @ 2007-04-22 21:36 UTC (permalink / raw)
  To: spearce; +Cc: git

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

 org.spearce.egit.core.test/.classpath              |    7 
 org.spearce.egit.core.test/.project                |   28 ++
 .../.settings/org.eclipse.jdt.core.prefs           |  320 +++++++++++++++++++++++
 .../.settings/org.eclipse.jdt.ui.prefs             |   10 +
 org.spearce.egit.core.test/META-INF/MANIFEST.MF    |   19 +
 org.spearce.egit.core.test/build.properties        |    4 
 .../org.spearce.egit.core--All-Tests.launch        |   39 +++
 .../egit/core/internal/mapping/T0002_history.java  |  108 ++++++++
 .../op/T0001_ConnectProviderOperationTest.java     |  118 ++++++++
 .../src/org/spearce/egit/core/test/Activator.java  |   50 ++++
 .../org/spearce/egit/core/test/GitTestCase.java    |   46 +++
 .../org/spearce/egit/core/test/TestProject.java    |  169 ++++++++++++
 12 files changed, 918 insertions(+), 0 deletions(-)

diff --git a/org.spearce.egit.core.test/.classpath b/org.spearce.egit.core.test/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/org.spearce.egit.core.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.spearce.egit.core.test/.project b/org.spearce.egit.core.test/.project
new file mode 100644
index 0000000..3b7fb2f
--- /dev/null
+++ b/org.spearce.egit.core.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.spearce.egit.core.test</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/org.spearce.egit.core.test/.settings/org.eclipse.jdt.core.prefs b/org.spearce.egit.core.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..16fbddc
--- /dev/null
+++ b/org.spearce.egit.core.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,320 @@
+#Mon Jan 29 20:50:25 EST 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.format_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/org.spearce.egit.core.test/.settings/org.eclipse.jdt.ui.prefs b/org.spearce.egit.core.test/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..273e64b
--- /dev/null
+++ b/org.spearce.egit.core.test/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,10 @@
+#Mon Jan 29 20:38:19 EST 2007
+eclipse.preferences.version=1
+formatter_profile=_EGit
+formatter_settings_version=10
+internal.default.compliance=user
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
diff --git a/org.spearce.egit.core.test/META-INF/MANIFEST.MF b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e201e46
--- /dev/null
+++ b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in
+Bundle-SymbolicName: org.spearce.egit.core.test
+Bundle-Version: 0.2.0
+Bundle-Activator: org.spearce.egit.core.test.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.team.core,
+ org.junit,
+ org.spearce.egit.core,
+ org.spearce.egit.ui,
+ org.spearce.jgit,
+ org.eclipse.core.filesystem
+Eclipse-LazyStart: true
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.junit,
+ org.eclipse.jdt.launching
+Export-Package: org.spearce.egit.core.internal.mapping
diff --git a/org.spearce.egit.core.test/build.properties b/org.spearce.egit.core.test/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.spearce.egit.core.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/org.spearce.egit.core.test/org.spearce.egit.core--All-Tests.launch b/org.spearce.egit.core.test/org.spearce.egit.core--All-Tests.launch
new file mode 100644
index 0000000..f4c9d3c
--- /dev/null
+++ b/org.spearce.egit.core.test/org.spearce.egit.core--All-Tests.launch
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<stringAttribute key="bootstrap" value=""/>
+<booleanAttribute key="useProduct" value="true"/>
+<booleanAttribute key="tracing" value="false"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.spearce.egit.core.test"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<stringAttribute key="checked" value="[NONE]"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="clearws" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.spearce.egit.core.test"/>
+<booleanAttribute key="askclear" value="false"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.spearce.egit.core.test"/>
+</listAttribute>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
+</launchConfiguration>
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/internal/mapping/T0002_history.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/internal/mapping/T0002_history.java
new file mode 100644
index 0000000..aaf9dce
--- /dev/null
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/internal/mapping/T0002_history.java
@@ -0,0 +1,108 @@
+/*
+ *  Copyright (C) 2006  Robin Rosenberg <robin.rosenberg@dewire.com>
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License, version 2.1, as published by the Free Software Foundation.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
+ */
+package org.spearce.egit.core.internal.mapping;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Date;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.history.IFileHistory;
+import org.eclipse.team.core.history.IFileHistoryProvider;
+import org.eclipse.team.core.history.IFileRevision;
+import org.spearce.egit.core.GitProvider;
+import org.spearce.egit.core.op.ConnectProviderOperation;
+import org.spearce.egit.core.test.GitTestCase;
+import org.spearce.jgit.lib.Commit;
+import org.spearce.jgit.lib.FileTreeEntry;
+import org.spearce.jgit.lib.ObjectId;
+import org.spearce.jgit.lib.ObjectWriter;
+import org.spearce.jgit.lib.PersonIdent;
+import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.lib.Tree;
+
+public class T0002_history extends GitTestCase {
+
+	protected static final PersonIdent jauthor;
+
+	protected static final PersonIdent jcommitter;
+
+	static {
+		jauthor = new PersonIdent("J. Author", "jauthor@example.com");
+		jcommitter = new PersonIdent("J. Committer", "jcommitter@example.com");
+	}
+
+	private File workDir;
+	private File gitDir;
+	private Repository thisGit;
+	private Tree tree;
+	private ObjectWriter objectWriter;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		project.createSourceFolder();
+		gitDir = new File(project.getProject().getWorkspace().getRoot()
+				.getRawLocation().toFile(), ".git");
+		workDir = gitDir.getParentFile();
+		thisGit = new Repository(gitDir);
+		thisGit.create();
+		objectWriter = new ObjectWriter(thisGit);
+
+		tree = new Tree(thisGit);
+		Tree projectTree = tree.addTree("Project-1");
+		File project1_a_txt = createFile("Project-1/A.txt","A.txt - first version\n");
+		addFile(projectTree,project1_a_txt);
+		projectTree.setId(objectWriter.writeTree(projectTree));
+		tree.setId(objectWriter.writeTree(tree));
+		Commit commit = new Commit(thisGit);
+		commit.setAuthor(new PersonIdent(jauthor, new Date(0L)));
+		commit.setCommitter(new PersonIdent(jcommitter, new Date(0L)));
+		commit.setMessage("Foo\n\nMessage");
+		commit.setTree(tree);
+		ObjectId commitId = objectWriter.writeCommit(commit);
+		thisGit.writeRef("refs/heads/master", commitId);
+
+		ConnectProviderOperation operation = new ConnectProviderOperation(
+				project.getProject(), null);
+		operation.run(null);
+	}
+	
+	private void addFile(Tree t,File f) throws IOException {
+		ObjectId id = objectWriter.writeBlob(f);
+		t.addEntry(new FileTreeEntry(t,id,f.getName().getBytes("UTF-8"),false));
+	}
+
+	private File createFile(String name, String content) throws IOException {
+		File f = new File(workDir, name);
+		FileWriter fileWriter = new FileWriter(f);
+		fileWriter.write(content);
+		fileWriter.close();
+		return f;
+	}
+
+	public void testShallowHistory() {
+		GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
+		assertNotNull(provider);
+		IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
+		IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
+		IFileRevision[] fileRevisions = fileHistory.getFileRevisions();
+		assertEquals(1, fileRevisions.length);
+		assertEquals("e2eadee5e6de7315df91cf03a75a8b2194a69af2", fileRevisions[0].getContentIdentifier());
+	}
+}
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
new file mode 100644
index 0000000..63ba83e
--- /dev/null
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/op/T0001_ConnectProviderOperationTest.java
@@ -0,0 +1,118 @@
+package org.spearce.egit.core.op;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.team.core.RepositoryProvider;
+import org.spearce.egit.core.test.GitTestCase;
+import org.spearce.jgit.lib.Commit;
+import org.spearce.jgit.lib.FileTreeEntry;
+import org.spearce.jgit.lib.ObjectId;
+import org.spearce.jgit.lib.ObjectWriter;
+import org.spearce.jgit.lib.PersonIdent;
+import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.lib.Tree;
+
+public class T0001_ConnectProviderOperationTest extends GitTestCase {
+
+	public void testNoRepository() throws CoreException {
+
+		ConnectProviderOperation operation = new ConnectProviderOperation(
+				project.getProject(), null);
+		operation.run(null);
+
+		// We are shared because we declared as shared
+		assertTrue(RepositoryProvider.isShared(project.getProject()));
+		assertTrue(!gitDir.exists());
+	}
+
+	public void testNewRepository() throws CoreException {
+
+		File gitDir = new File(project.getProject().getWorkspace().getRoot()
+				.getRawLocation().toFile(), ".git");
+		ConnectProviderOperation operation = new ConnectProviderOperation(
+				project.getProject(), gitDir);
+		operation.run(null);
+
+		assertTrue(RepositoryProvider.isShared(project.getProject()));
+
+		assertTrue(gitDir.exists());
+	}
+
+	public void testNewUnsharedFile() throws CoreException, IOException,
+			InterruptedException {
+
+		project.createSourceFolder();
+		IFile fileA = project.getProject().getFolder("src").getFile("A.java");
+		String srcA = "class A {\n" + "}\n";
+		fileA.create(new ByteArrayInputStream(srcA.getBytes()), false, null);
+
+		File gitDir = new File(project.getProject().getWorkspace().getRoot()
+				.getRawLocation().toFile(), ".git");
+		Repository thisGit = new Repository(gitDir);
+		thisGit.create();
+		Tree rootTree = new Tree(thisGit);
+		Tree prjTree = rootTree.addTree(project.getProject().getName());
+		Tree srcTree = prjTree.addTree("src");
+		FileTreeEntry entryA = srcTree.addFile("A.java");
+		ObjectWriter writer = new ObjectWriter(thisGit);
+		entryA.setId(writer.writeBlob(fileA.getRawLocation().toFile()));
+		srcTree.setId(writer.writeTree(srcTree));
+		prjTree.setId(writer.writeTree(prjTree));
+		rootTree.setId(writer.writeTree(rootTree));
+		Commit commit = new Commit(thisGit);
+		commit.setTree(rootTree);
+		commit.setAuthor(new PersonIdent("J. Git", "j.git@egit.org", new Date(
+				1999, 1, 1), TimeZone.getTimeZone("GMT+1")));
+		commit.setCommitter(commit.getAuthor());
+		commit.setMessage("testNewUnsharedFile\n\nJunit tests\n");
+		ObjectId id = writer.writeCommit(commit);
+		thisGit.writeRef("refs/heads/master", id);
+
+		// helper asserts, this is not what we are really testing
+		assertTrue("blob missing", new File(gitDir,
+				"objects/2e/2439c32d01f0ef39644d561945e8f4b2239489").exists());
+
+		assertTrue("tree missing", new File(gitDir,
+				"objects/87/a105cc4bc0a79885d07ec560c3eee49438acf0").exists());
+		assertTrue("tree missing", new File(gitDir,
+				"objects/08/ccc3d91a14d337a45f355d3d63bd97fd5e4db9").exists());
+		assertTrue("tree missing", new File(gitDir,
+				"objects/9d/aeec817090098f05eeca858e3a552d78b0a346").exists());
+
+		assertTrue("commit missing", new File(gitDir,
+				"objects/45/df73fd9abbc2c61620c036948b1157e4d21253").exists());
+
+		ConnectProviderOperation operation = new ConnectProviderOperation(
+				project.getProject(), null);
+		operation.run(null);
+
+		final boolean f[] = new boolean[1];
+		new Job("wait") {
+			protected IStatus run(IProgressMonitor monitor) {
+
+				System.out.println("MyJob");
+				f[0] = true;
+				return null;
+			}
+
+			{
+				setRule(project.getProject());
+				schedule();
+			}
+		};
+		while (!f[0]) {
+			System.out.println("Waiting");
+			Thread.sleep(1000);
+		}
+		System.out.println("DONE");
+	}
+}
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/test/Activator.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/Activator.java
new file mode 100644
index 0000000..9807c84
--- /dev/null
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/Activator.java
@@ -0,0 +1,50 @@
+package org.spearce.egit.core.test;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.spearce.egit.core.test";
+
+	// The shared instance
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/test/GitTestCase.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/GitTestCase.java
new file mode 100644
index 0000000..4e4fbf0
--- /dev/null
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/GitTestCase.java
@@ -0,0 +1,46 @@
+package org.spearce.egit.core.test;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+public abstract class GitTestCase extends TestCase {
+
+	protected TestProject project;
+
+	protected File gitDir;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		project = new TestProject();
+		gitDir = new File(project.getProject().getWorkspace().getRoot()
+				.getRawLocation().toFile(), ".git");
+		rmrf(gitDir);
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		project.dispose();
+		rmrf(gitDir);
+	}
+
+	private void rmrf(File d) throws IOException {
+		if (!d.exists())
+			return;
+
+		File[] files = d.listFiles();
+		if (files != null) {
+			for (int i = 0; i < files.length; ++i) {
+				if (files[i].isDirectory())
+					rmrf(files[i]);
+				else if (!files[i].delete())
+					throw new IOException(files[i] + " in use or undeletable");
+			}
+		}
+		if (!d.delete())
+			throw new IOException(d + " in use or undeletable");
+		assert !d.exists();
+	}
+
+}
diff --git a/org.spearce.egit.core.test/src/org/spearce/egit/core/test/TestProject.java b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/TestProject.java
new file mode 100644
index 0000000..63c0d4b
--- /dev/null
+++ b/org.spearce.egit.core.test/src/org/spearce/egit/core/test/TestProject.java
@@ -0,0 +1,169 @@
+package org.spearce.egit.core.test;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IPluginRegistry;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.JavaRuntime;
+
+public class TestProject {
+	public IProject project;
+
+	public IJavaProject javaProject;
+
+	private IPackageFragmentRoot sourceFolder;
+
+	public TestProject() throws CoreException {
+		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+		project = root.getProject("Project-1");
+		project.create(null);
+		project.open(null);
+		javaProject = JavaCore.create(project);
+		IFolder binFolder = createBinFolder();
+		setJavaNature();
+		javaProject.setRawClasspath(new IClasspathEntry[0], null);
+		createOutputFolder(binFolder);
+		addSystemLibraries();
+	}
+
+	public IProject getProject() {
+		return project;
+	}
+
+	public IJavaProject getJavaProject() {
+		return javaProject;
+	}
+
+	public void addJar(String plugin, String jar) throws MalformedURLException,
+			IOException, JavaModelException {
+		Path result = findFileInPlugin(plugin, jar);
+		IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+		IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+		System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+		newEntries[oldEntries.length] = JavaCore.newLibraryEntry(result, null,
+				null);
+		javaProject.setRawClasspath(newEntries, null);
+	}
+
+	public IPackageFragment createPackage(String name) throws CoreException {
+		if (sourceFolder == null)
+			sourceFolder = createSourceFolder();
+		return sourceFolder.createPackageFragment(name, false, null);
+	}
+
+	public IType createType(IPackageFragment pack, String cuName, String source)
+			throws JavaModelException {
+		StringBuffer buf = new StringBuffer();
+		buf.append("package " + pack.getElementName() + ";\n");
+		buf.append("\n");
+		buf.append(source);
+		ICompilationUnit cu = pack.createCompilationUnit(cuName,
+				buf.toString(), false, null);
+		return cu.getTypes()[0];
+	}
+
+	public void dispose() throws CoreException {
+		waitForIndexer();
+		project.delete(true, true, null);
+	}
+
+	private IFolder createBinFolder() throws CoreException {
+		IFolder binFolder = project.getFolder("bin");
+		binFolder.create(false, true, null);
+		return binFolder;
+	}
+
+	private void setJavaNature() throws CoreException {
+		IProjectDescription description = project.getDescription();
+		description.setNatureIds(new String[] { JavaCore.NATURE_ID });
+		project.setDescription(description, null);
+	}
+
+	private void createOutputFolder(IFolder binFolder)
+			throws JavaModelException {
+		IPath outputLocation = binFolder.getFullPath();
+		javaProject.setOutputLocation(outputLocation, null);
+	}
+
+	public IPackageFragmentRoot createSourceFolder() throws CoreException {
+		IFolder folder = project.getFolder("src");
+		folder.create(false, true, null);
+		IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(folder);
+		IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+		IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+		System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+		newEntries[oldEntries.length] = JavaCore.newSourceEntry(root.getPath());
+		javaProject.setRawClasspath(newEntries, null);
+		return root;
+	}
+
+	private void addSystemLibraries() throws JavaModelException {
+		IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
+		IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
+		System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
+		newEntries[oldEntries.length] = JavaRuntime
+				.getDefaultJREContainerEntry();
+		javaProject.setRawClasspath(newEntries, null);
+	}
+
+	private Path findFileInPlugin(String plugin, String file)
+			throws MalformedURLException, IOException {
+		IPluginRegistry registry = Platform.getPluginRegistry();
+		IPluginDescriptor descriptor = registry.getPluginDescriptor(plugin);
+		URL pluginURL = descriptor.getInstallURL();
+		URL jarURL = new URL(pluginURL, file);
+		URL localJarURL = Platform.asLocalURL(jarURL);
+		return new Path(localJarURL.getPath());
+	}
+
+	public void waitForIndexer() {
+		//                new SearchEngine().searchAllTypeNames(ResourcesPlugin.getWorkspace(),
+		//                                null, null, IJavaSearchConstants.EXACT_MATCH,
+		//                                IJavaSearchConstants.CASE_SENSITIVE,
+		//                                IJavaSearchConstants.CLASS, SearchEngine
+		//                                                .createJavaSearchScope(new IJavaElement[0]),
+		//                                new ITypeNameRequestor() {
+		//                                        public void acceptClass(char[] packageName,
+		//                                                        char[] simpleTypeName, char[][] enclosingTypeNames,
+		//                                                        String path) {
+		//                                        }
+		//                                        public void acceptInterface(char[] packageName,
+		//                                                        char[] simpleTypeName, char[][] enclosingTypeNames,
+		//                                                        String path) {
+		//                                        }
+		//                                }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
+	}
+
+	/**
+	 * @return Returns the sourceFolder.
+	 */
+	public IPackageFragmentRoot getSourceFolder() {
+		return sourceFolder;
+	}
+
+	/**
+	 * @param sourceFolder The sourceFolder to set.
+	 */
+	public void setSourceFolder(IPackageFragmentRoot sourceFolder) {
+		this.sourceFolder = sourceFolder;
+	}
+}

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [EGIT PATCH 2/4] Use the Git sort order.
  2007-04-22 21:36 ` [EGIT PATCH 2/4] Use the Git sort order Robin Rosenberg
@ 2007-04-23 22:39   ` Robin Rosenberg
  2007-04-24 17:09     ` Shawn O. Pearce
  0 siblings, 1 reply; 8+ messages in thread
From: Robin Rosenberg @ 2007-04-23 22:39 UTC (permalink / raw)
  To: spearce; +Cc: git

Oops, lost the decoration here.

-- robin

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit
/core/project/GitProjectData.java
index 0c4683e..5c250c0 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
@@ -274,11 +274,11 @@ public class GitProjectData {
                return (RepositoryMapping) c2mapping.get(r);
        }

-       public TreeEntry[] getActiveDiffTreeEntries(IResource r)
+       public TreeEntry[] getActiveDiffTreeEntries(IResource res)
                        throws CoreException {
                String s = null;
                RepositoryMapping m = null;
-
+               IResource r = res;
                while (r != null) {
                        m = getRepositoryMapping(r);
                        if (m != null) {
@@ -296,7 +296,7 @@ public class GitProjectData {

                if (s != null && m != null && m.getActiveDiff() != null) {
                        try {
-                               if (r.getType() == IResource.FILE)
+                               if (res.getType() == IResource.FILE)
                                        return m.getActiveDiff().findBlobMember(s);
                                else
                                        return m.getActiveDiff().findTreeMember(s);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [EGIT PATCH 4/4] Add a JUnit test project for egit.
  2007-04-22 21:36 ` [EGIT PATCH 4/4] Add a JUnit test project for egit Robin Rosenberg
@ 2007-04-23 22:41   ` Robin Rosenberg
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Rosenberg @ 2007-04-23 22:41 UTC (permalink / raw)
  To: spearce; +Cc: git

Match the version number of this plugin.

-- robin

diff --git a/org.spearce.egit.core.test/META-INF/MANIFEST.MF b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
index e201e46..667100f 100644
--- a/org.spearce.egit.core.test/META-INF/MANIFEST.MF
+++ b/org.spearce.egit.core.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Test Plug-in
 Bundle-SymbolicName: org.spearce.egit.core.test
-Bundle-Version: 0.2.0
+Bundle-Version: 0.2.1.qualifier
 Bundle-Activator: org.spearce.egit.core.test.Activator
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.team.core,

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [EGIT PATCH 2/4] Use the Git sort order.
  2007-04-23 22:39   ` Robin Rosenberg
@ 2007-04-24 17:09     ` Shawn O. Pearce
  0 siblings, 0 replies; 8+ messages in thread
From: Shawn O. Pearce @ 2007-04-24 17:09 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
> Oops, lost the decoration here.

Thanks, I applied all 6 patches.  Good stuff.

Unfortunately this particular patch was totally damaged beyond
repair.  What happened to it?  I redid the changes by hand, as even
after fixing the line wrapping on the `diff --git` header line
`git-am -3 --whitespace=strip` was unable to apply the patch to
0c4683e.  The patch doesn't apply, at all, to that blob.

> diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit
> /core/project/GitProjectData.java
> index 0c4683e..5c250c0 100644
> --- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
> +++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
> @@ -274,11 +274,11 @@ public class GitProjectData {
>                 return (RepositoryMapping) c2mapping.get(r);
>         }
> 
> -       public TreeEntry[] getActiveDiffTreeEntries(IResource r)
> +       public TreeEntry[] getActiveDiffTreeEntries(IResource res)
>                         throws CoreException {
>                 String s = null;
>                 RepositoryMapping m = null;
> -
> +               IResource r = res;
>                 while (r != null) {
>                         m = getRepositoryMapping(r);
>                         if (m != null) {
> @@ -296,7 +296,7 @@ public class GitProjectData {
> 
>                 if (s != null && m != null && m.getActiveDiff() != null) {
>                         try {
> -                               if (r.getType() == IResource.FILE)
> +                               if (res.getType() == IResource.FILE)
>                                         return m.getActiveDiff().findBlobMember(s);
>                                 else
>                                         return m.getActiveDiff().findTreeMember(s);

-- 
Shawn.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-04-24 17:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-22 21:35 [EGIT PATCH 0/4] Unit test for plugin and then some Robin Rosenberg
2007-04-22 21:35 ` [EGIT PATCH 1/4] Drop unneeded GitTreeStorage Robin Rosenberg
2007-04-22 21:36 ` [EGIT PATCH 2/4] Use the Git sort order Robin Rosenberg
2007-04-23 22:39   ` Robin Rosenberg
2007-04-24 17:09     ` Shawn O. Pearce
2007-04-22 21:36 ` [EGIT PATCH 3/4] Add writeRef method and make writeSymref public Robin Rosenberg
2007-04-22 21:36 ` [EGIT PATCH 4/4] Add a JUnit test project for egit Robin Rosenberg
2007-04-23 22:41   ` Robin Rosenberg

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