public class StashApplyCommand extends GitCommand<ObjectId>
| Modifier and Type | Field and Description |
|---|---|
private boolean |
applyIndex |
private boolean |
applyUntracked |
private static java.lang.String |
DEFAULT_REF |
private boolean |
ignoreRepositoryState |
private java.lang.String |
stashRef |
private MergeStrategy |
strategy |
repo| Constructor and Description |
|---|
StashApplyCommand(Repository repo)
Create command to apply the changes of a stashed commit
|
| Modifier and Type | Method and Description |
|---|---|
ObjectId |
call() |
private void |
checkoutPath(DirCacheEntry entry,
ObjectReader reader,
DirCacheCheckout.CheckoutMetadata checkoutMetadata) |
private ObjectId |
getStashId() |
StashApplyCommand |
ignoreRepositoryState(boolean willIgnoreRepositoryState)
Whether to ignore the repository state when applying the stash
|
private void |
resetIndex(RevTree tree) |
private void |
resetUntracked(RevTree tree) |
void |
setApplyIndex(boolean applyIndex)
Whether to restore the index state
|
void |
setApplyUntracked(boolean applyUntracked)
Whether the command should restore untracked files
|
StashApplyCommand |
setStashRef(java.lang.String stashRef)
Set the stash reference to apply
|
StashApplyCommand |
setStrategy(MergeStrategy strategy)
Set the
MergeStrategy to use. |
checkCallable, getRepository, setCallableprivate static final java.lang.String DEFAULT_REF
private java.lang.String stashRef
private boolean applyIndex
private boolean applyUntracked
private boolean ignoreRepositoryState
private MergeStrategy strategy
public StashApplyCommand(Repository repo)
repo - the Repository to apply the stash
topublic StashApplyCommand setStashRef(java.lang.String stashRef)
This will default to apply the latest stashed commit (stash@{0}) if unspecified
stashRef - name of the stash Ref to applythispublic StashApplyCommand ignoreRepositoryState(boolean willIgnoreRepositoryState)
willIgnoreRepositoryState - whether to ignore the repository state when applying the stashthisprivate ObjectId getStashId() throws GitAPIException
GitAPIExceptionpublic ObjectId call() throws GitAPIException, WrongRepositoryStateException, NoHeadException, StashApplyFailureException
Execute the command
Apply the changes in a stashed commit to the working directory and index
call in interface java.util.concurrent.Callable<ObjectId>call in class GitCommand<ObjectId>GitAPIExceptionWrongRepositoryStateExceptionNoHeadExceptionStashApplyFailureExceptionpublic void setApplyIndex(boolean applyIndex)
applyIndex - true (default) if the command should restore the index statepublic StashApplyCommand setStrategy(MergeStrategy strategy)
MergeStrategy to use.strategy - The merge strategy to use in order to merge during this
command execution.thispublic void setApplyUntracked(boolean applyUntracked)
applyUntracked - true (default) if the command should restore untracked filesprivate void resetIndex(RevTree tree) throws java.io.IOException
java.io.IOExceptionprivate void resetUntracked(RevTree tree) throws CheckoutConflictException, java.io.IOException
CheckoutConflictExceptionjava.io.IOExceptionprivate void checkoutPath(DirCacheEntry entry, ObjectReader reader, DirCacheCheckout.CheckoutMetadata checkoutMetadata)