Browse Source

Added one-tree constructor to DirCacheCheckout

When DirCacheCheckout should be used to checkout only one
tree (reset --hard, clone) then we had to use the standard
constructor and specify null as value for head. This change
adds explicit constructors not taking HEAD and documents
that.

Bug: 330021
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
stable-0.10
Christian Halstrick 14 years ago
parent
commit
484807e82b
  1. 52
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java

52
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java vendored

@ -144,8 +144,8 @@ public class DirCacheCheckout {
}
/**
* Constructs a DirCacheCeckout for fast-forwarding from one tree to
* another, merging it with the index
* Constructs a DirCacheCeckout for merging and checking out two trees (HEAD
* and mergeCommitTree) and the index.
*
* @param repo
* the repository in which we do the checkout
@ -169,6 +169,48 @@ public class DirCacheCheckout {
this.workingTree = workingTree;
}
/**
* Constructs a DirCacheCeckout for merging and checking out two trees (HEAD
* and mergeCommitTree) and the index. As iterator over the working tree
* this constructor creates a standard {@link FileTreeIterator}
*
* @param repo
* the repository in which we do the checkout
* @param headCommitTree
* the id of the tree of the head commit
* @param dc
* the (already locked) Dircache for this repo
* @param mergeCommitTree
* the id of the tree of the
* @throws IOException
*/
public DirCacheCheckout(Repository repo, ObjectId headCommitTree,
DirCache dc, ObjectId mergeCommitTree) throws IOException {
this(repo, headCommitTree, dc, mergeCommitTree, new FileTreeIterator(
repo.getWorkTree(), repo.getFS(),
WorkingTreeOptions.createDefaultInstance()));
}
/**
* Constructs a DirCacheCeckout for checking out one tree, merging with the
* index.
*
* @param repo
* the repository in which we do the checkout
* @param dc
* the (already locked) Dircache for this repo
* @param mergeCommitTree
* the id of the tree we want to fast-forward to
* @param workingTree
* an iterator over the repositories Working Tree
* @throws IOException
*/
public DirCacheCheckout(Repository repo, DirCache dc,
ObjectId mergeCommitTree, WorkingTreeIterator workingTree)
throws IOException {
this(repo, null, dc, mergeCommitTree, workingTree);
}
/**
* Constructs a DirCacheCeckout for checking out one tree, merging with the
* index. As iterator over the working tree this constructor creates a
@ -176,17 +218,15 @@ public class DirCacheCheckout {
*
* @param repo
* the repository in which we do the checkout
* @param headCommitTree
* the id of the tree of the head commit
* @param dc
* the (already locked) Dircache for this repo
* @param mergeCommitTree
* the id of the tree of the
* @throws IOException
*/
public DirCacheCheckout(Repository repo, ObjectId headCommitTree, DirCache dc,
public DirCacheCheckout(Repository repo, DirCache dc,
ObjectId mergeCommitTree) throws IOException {
this(repo, headCommitTree, dc, mergeCommitTree, new FileTreeIterator(
this(repo, null, dc, mergeCommitTree, new FileTreeIterator(
repo.getWorkTree(), repo.getFS(),
WorkingTreeOptions.createDefaultInstance()));
}

Loading…
Cancel
Save