Package org.eclipse.jgit.dircache
Class Checkout
java.lang.Object
org.eclipse.jgit.dircache.Checkout
An object that can be used to check out many files.
- Since:
- 6.6.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FileModeCache
private final WorkingTreeOptions
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionCheckout
(Repository repo) Creates a newCheckout
for checking out from the given repository.Checkout
(Repository repo, WorkingTreeOptions options) Creates a newCheckout
for checking out from the given repository. -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkout
(DirCacheEntry entry, DirCacheCheckout.CheckoutMetadata metadata, ObjectReader reader, String gitPath) Checks out the file given by theDirCacheEntry
.void
checkoutGitlink
(DirCacheEntry entry, String gitPath) Checks out the gitlink given by theDirCacheEntry
.Retrieves theWorkingTreeOptions
of the repository that are used.void
safeCreateParentDirectory
(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.
-
Field Details
-
cache
-
options
-
recursiveDelete
private boolean recursiveDelete
-
-
Constructor Details
-
Checkout
Creates a newCheckout
for checking out from the given repository.- Parameters:
repo
- theRepository
to check out from
-
Checkout
Creates a newCheckout
for checking out from the given repository.- Parameters:
repo
- theRepository
to check out fromoptions
- theWorkingTreeOptions
to use; ifnull
, read from therepo
config when this object is created
-
-
Method Details
-
getWorkingTreeOptions
Retrieves theWorkingTreeOptions
of 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 thegitPath
makeSpace
- 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
-DirCacheEntry
to check outgitPath
- the git path of the entry, if known already; otherwisenull
and 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
-DirCacheEntry
to check outmetadata
-DirCacheCheckout.CheckoutMetadata
to use for CR/LF handling and smudge filteringreader
-ObjectReader
to usegitPath
- the git path of the entry, if known already; otherwisenull
and it's read from the entry itself- Throws:
IOException
- if the file cannot be checked out
-