Browse Source

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 <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
stable-0.11
Shawn O. Pearce 14 years ago committed by Chris Aniszczyk
parent
commit
0c22243c4a
  1. 13
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java

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

Loading…
Cancel
Save