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>
This commit is contained in:
Christian Halstrick 2010-11-13 00:42:01 +01:00
parent e8315ce19d
commit 484807e82b
1 changed files with 47 additions and 7 deletions

View File

@ -144,8 +144,8 @@ public List<String> getRemoved() {
}
/**
* 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
@ -170,9 +170,9 @@ public DirCacheCheckout(Repository repo, ObjectId headCommitTree, DirCache dc,
}
/**
* Constructs a DirCacheCeckout for checking out one tree, merging with the
* index. As iterator over the working tree this constructor creates a
* standard {@link FileTreeIterator}
* 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
@ -184,13 +184,53 @@ public DirCacheCheckout(Repository repo, ObjectId headCommitTree, DirCache dc,
* the id of the tree of the
* @throws IOException
*/
public DirCacheCheckout(Repository repo, ObjectId headCommitTree, DirCache dc,
ObjectId mergeCommitTree) 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
* standard {@link FileTreeIterator}
*
* @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 of the
* @throws IOException
*/
public DirCacheCheckout(Repository repo, DirCache dc,
ObjectId mergeCommitTree) throws IOException {
this(repo, null, dc, mergeCommitTree, new FileTreeIterator(
repo.getWorkTree(), repo.getFS(),
WorkingTreeOptions.createDefaultInstance()));
}
/**
* Scan head, index and merge tree. Used during normal checkout or merge
* operations.