Package org.eclipse.jgit.dircache
Class Checkout
- java.lang.Object
-
- org.eclipse.jgit.dircache.Checkout
-
public class Checkout extends java.lang.ObjectAn object that can be used to check out many files.- Since:
- 6.6.1
-
-
Field Summary
Fields Modifier and Type Field Description private FileModeCachecacheprivate WorkingTreeOptionsoptionsprivate booleanrecursiveDelete
-
Constructor Summary
Constructors Constructor Description Checkout(Repository repo)Creates a newCheckoutfor checking out from the given repository.Checkout(Repository repo, WorkingTreeOptions options)Creates a newCheckoutfor checking out from the given repository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckout(DirCacheEntry entry, DirCacheCheckout.CheckoutMetadata metadata, ObjectReader reader, java.lang.String gitPath)Checks out the file given by theDirCacheEntry.voidcheckoutGitlink(DirCacheEntry entry, java.lang.String gitPath)Checks out the gitlink given by theDirCacheEntry.WorkingTreeOptionsgetWorkingTreeOptions()Retrieves theWorkingTreeOptionsof the repository that are used.voidsafeCreateParentDirectory(java.lang.String gitPath, java.io.File parentDir, boolean makeSpace)Ensure that the given parent directory exists, and cache the information that gitPath refers to a file.CheckoutsetRecursiveDeletion(boolean recursive)Defines whether directories that are in the way of the file to be checked out shall be deleted recursively.
-
-
-
Field Detail
-
cache
private final FileModeCache cache
-
options
private final WorkingTreeOptions options
-
recursiveDelete
private boolean recursiveDelete
-
-
Constructor Detail
-
Checkout
public Checkout(@NonNull Repository repo)
Creates a newCheckoutfor checking out from the given repository.- Parameters:
repo- theRepositoryto check out from
-
Checkout
public Checkout(@NonNull Repository repo, WorkingTreeOptions options)
Creates a newCheckoutfor checking out from the given repository.- Parameters:
repo- theRepositoryto check out fromoptions- theWorkingTreeOptionsto use; ifnull, read from therepoconfig when this object is created
-
-
Method Detail
-
getWorkingTreeOptions
public WorkingTreeOptions getWorkingTreeOptions()
Retrieves theWorkingTreeOptionsof the repository that are used.- Returns:
- the
WorkingTreeOptions
-
setRecursiveDeletion
public Checkout setRecursiveDeletion(boolean recursive)
Defines whether directories that are in the way of the file to be checked out shall be deleted recursively.- Parameters:
recursive- whether to delete such directories recursively- Returns:
this
-
safeCreateParentDirectory
public void safeCreateParentDirectory(java.lang.String gitPath, java.io.File parentDir, boolean makeSpace) throws java.io.IOExceptionEnsure that the given parent directory exists, and cache the information that gitPath refers to a file.- Parameters:
gitPath- of the file to be writtenparentDir- directory in which the file shall be placed, assumed to be the parent of thegitPathmakeSpace- whether to delete a possibly existing file atparentDir- Throws:
java.io.IOException- if the directory cannot be created, if necessary
-
checkoutGitlink
public void checkoutGitlink(DirCacheEntry entry, java.lang.String gitPath) throws java.io.IOException
Checks out the gitlink given by theDirCacheEntry.- Parameters:
entry-DirCacheEntryto check outgitPath- the git path of the entry, if known already; otherwisenulland it's read from the entry itself- Throws:
java.io.IOException- if the gitlink cannot be checked out
-
checkout
public void checkout(DirCacheEntry entry, DirCacheCheckout.CheckoutMetadata metadata, ObjectReader reader, java.lang.String gitPath) throws java.io.IOException
Checks out the file given by theDirCacheEntry.- Parameters:
entry-DirCacheEntryto check outmetadata-DirCacheCheckout.CheckoutMetadatato use for CR/LF handling and smudge filteringreader-ObjectReaderto usegitPath- the git path of the entry, if known already; otherwisenulland it's read from the entry itself- Throws:
java.io.IOException- if the file cannot be checked out
-
-