Package org.eclipse.jgit.dircache
Class Checkout
- java.lang.Object
-
- org.eclipse.jgit.dircache.Checkout
-
public class Checkout extends java.lang.Object
An object that can be used to check out many files.- Since:
- 6.6.1
-
-
Field Summary
Fields Modifier and Type Field Description private FileModeCache
cache
private WorkingTreeOptions
options
private boolean
recursiveDelete
-
Constructor Summary
Constructors Constructor Description Checkout(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkout(DirCacheEntry entry, DirCacheCheckout.CheckoutMetadata metadata, ObjectReader reader, java.lang.String gitPath)
Checks out the file given by theDirCacheEntry
.void
checkoutGitlink(DirCacheEntry entry, java.lang.String gitPath)
Checks out the gitlink given by theDirCacheEntry
.WorkingTreeOptions
getWorkingTreeOptions()
Retrieves theWorkingTreeOptions
of the repository that are used.void
safeCreateParentDirectory(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.Checkout
setRecursiveDeletion(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 newCheckout
for checking out from the given repository.- Parameters:
repo
- theRepository
to check out from
-
Checkout
public Checkout(@NonNull Repository repo, WorkingTreeOptions options)
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 Detail
-
getWorkingTreeOptions
public WorkingTreeOptions getWorkingTreeOptions()
Retrieves theWorkingTreeOptions
of 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.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:
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
-DirCacheEntry
to check outgitPath
- the git path of the entry, if known already; otherwisenull
and 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
-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:
java.io.IOException
- if the file cannot be checked out
-
-