java.lang.Object
org.eclipse.jgit.dircache.Checkout
An object that can be used to check out many files.
- Since:
- 6.6.1
-
Constructor Summary
ConstructorsConstructorDescriptionCheckout(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
Modifier and TypeMethodDescriptionvoidcheckout(DirCacheEntry entry, DirCacheCheckout.CheckoutMetadata metadata, ObjectReader reader, String gitPath) Checks out the file given by theDirCacheEntry.voidcheckoutGitlink(DirCacheEntry entry, String gitPath) Checks out the gitlink given by theDirCacheEntry.Retrieves theWorkingTreeOptionsof the repository that are used.voidsafeCreateParentDirectory(String gitPath, File parentDir, boolean makeSpace) Ensure that the given parent directory exists, and cache the information that gitPath refers to a file.setRecursiveDeletion(boolean recursive) Defines whether directories that are in the way of the file to be checked out shall be deleted recursively.
-
Constructor Details
-
Checkout
Creates a newCheckoutfor checking out from the given repository.- Parameters:
repo- theRepositoryto check out from
-
Checkout
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 Details
-
getWorkingTreeOptions
Retrieves theWorkingTreeOptionsof the repository that are used.- Returns:
- the
WorkingTreeOptions
-
setRecursiveDeletion
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(String gitPath, File parentDir, boolean makeSpace) throws IOException Ensure 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:
IOException- if the directory cannot be created, if necessary
-
checkoutGitlink
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:
IOException- if the gitlink cannot be checked out
-
checkout
public void checkout(DirCacheEntry entry, DirCacheCheckout.CheckoutMetadata metadata, ObjectReader reader, String gitPath) throws 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:
IOException- if the file cannot be checked out
-