From 0c22243c4a59560529e7bd271094837c0fbf5295 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 15 Dec 2010 16:14:19 -0800 Subject: clone: Use DirCacheCheckout This simple change lets us get rid of WorkDirCheckout from JGit, and all of its supporting code. Change-Id: I1a5aabe9ab4a2b156fd37cc7e9ededb4ed70f53a Signed-off-by: Shawn O. Pearce Signed-off-by: Chris Aniszczyk --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'org.eclipse.jgit.pgm') diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index 8eccdedc3f..903f2e889d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -51,18 +51,17 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.eclipse.jgit.dircache.DirCache; +import org.eclipse.jgit.dircache.DirCacheCheckout; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.NotSupportedException; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.GitIndex; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RefComparator; import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.TextProgressMonitor; -import org.eclipse.jgit.lib.Tree; -import org.eclipse.jgit.lib.WorkDirCheckout; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.storage.file.FileBasedConfig; @@ -187,13 +186,9 @@ class Clone extends AbstractFetchCommand { u.setNewObjectId(commit); u.forceUpdate(); - final GitIndex index = new GitIndex(db); - final Tree tree = db.mapTree(commit.getTree()); - final WorkDirCheckout co; - - co = new WorkDirCheckout(db, db.getWorkTree(), index, tree); + DirCache dc = db.lockDirCache(); + DirCacheCheckout co = new DirCacheCheckout(db, dc, commit.getTree()); co.checkout(); - index.write(); } private RevCommit parseCommit(final Ref branch) -- cgit v1.2.3