Top Description Fields Constructors Methods
org.eclipse.jgit.dircache

public Class Checkout

extends Object
Class Inheritance
Imports
java.io.File, .FileOutputStream, .IOException, java.nio.file.Files, .LinkOption, .StandardCopyOption, java.text.MessageFormat, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.dircache.DirCacheCheckout.CheckoutMetadata, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.FileMode, .FileModeCache, .ObjectLoader, .ObjectReader, .Repository, .CoreConfig.EolStreamType, .CoreConfig.SymLinks, .FileModeCache.CacheItem, org.eclipse.jgit.treewalk.WorkingTreeOptions, org.eclipse.jgit.util.FS, .FileUtils, .RawParseUtils

An object that can be used to check out many files.
Since
6.6.1

Field Summary

Modifier and TypeField and Description
private final FileModeCache
private final WorkingTreeOptions
private boolean

Constructor Summary

AccessConstructor and Description
public
Checkout(Repository
the Repository to check out from
repo
)

Creates a new Checkout for checking out from the given repository.

public
Checkout(Repository
the Repository to check out from
repo
,
WorkingTreeOptions
the WorkingTreeOptions to use; if null, read from the repo config when this object is created
options
)

Creates a new Checkout for checking out from the given repository.

Method Summary

Modifier and TypeMethod and Description
public void
checkout(DirCacheEntry
DirCacheEntry to check out
entry
,
DirCacheCheckout.CheckoutMetadata
CheckoutMetadata to use for CR/LF handling and smudge filtering
metadata
,
ObjectReader reader, String
the git path of the entry, if known already; otherwise null and it's read from the entry itself
gitPath
)

Checks out the file given by the DirCacheEntry.

public WorkingTreeOptions

Returns:

the WorkingTreeOptions
getWorkingTreeOptions
()

Retrieves the WorkingTreeOptions of the repository that are used.

public void
safeCreateParentDirectory(String
of the file to be written
gitPath
,
File
directory in which the file shall be placed, assumed to be the parent of the gitPath
parentDir
,
boolean
whether to delete a possibly existing file at parentDir
makeSpace
)

Ensure that the given parent directory exists, and cache the information that gitPath refers to a file.

public Checkout

Returns:

this
setRecursiveDeletion
(boolean
whether to delete such directories recursively
recursive
)

Defines whether directories that are in the way of the file to be checked out shall be deleted recursively.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
private final FileModeCache cache
optionsback to summary
private final WorkingTreeOptions options
recursiveDeleteback to summary
private boolean recursiveDelete

Constructor Detail

Checkoutback to summary
public Checkout(Repository repo)

Creates a new Checkout for checking out from the given repository.

Parameters
repo:Repository

the Repository to check out from

Checkoutback to summary
public Checkout(Repository repo, WorkingTreeOptions options)

Creates a new Checkout for checking out from the given repository.

Parameters
repo:Repository

the Repository to check out from

options:WorkingTreeOptions

the WorkingTreeOptions to use; if null, read from the repo config when this object is created

Method Detail

checkoutback to summary
public void checkout(DirCacheEntry entry, DirCacheCheckout.CheckoutMetadata metadata, ObjectReader reader, String gitPath) throws IOException

Checks out the file given by the DirCacheEntry.

Parameters
entry:DirCacheEntry

DirCacheEntry to check out

metadata:DirCacheCheckout.CheckoutMetadata

CheckoutMetadata to use for CR/LF handling and smudge filtering

reader:ObjectReader

ObjectReader to use

gitPath:String

the git path of the entry, if known already; otherwise null and it's read from the entry itself

Exceptions
IOException:
if the file cannot be checked out
getWorkingTreeOptionsback to summary
public WorkingTreeOptions getWorkingTreeOptions()

Retrieves the WorkingTreeOptions of the repository that are used.

Returns:WorkingTreeOptions

the WorkingTreeOptions

safeCreateParentDirectoryback to summary
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:String

of the file to be written

parentDir:File

directory in which the file shall be placed, assumed to be the parent of the gitPath

makeSpace:boolean

whether to delete a possibly existing file at parentDir

Exceptions
IOException:
if the directory cannot be created, if necessary
setRecursiveDeletionback to summary
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:boolean

whether to delete such directories recursively

Returns:Checkout

this