public class StashApplyCommand extends GitCommand<ObjectId>
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DEFAULT_REF |
private boolean |
ignoreRepositoryState |
private boolean |
restoreIndex |
private boolean |
restoreUntracked |
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)
Deprecated.
use
setRestoreIndex(boolean) instead |
void |
setApplyUntracked(boolean applyUntracked)
Deprecated.
use
setRestoreUntracked(boolean) instead |
StashApplyCommand |
setRestoreIndex(boolean restoreIndex)
Whether to restore the index state
|
StashApplyCommand |
setRestoreUntracked(boolean restoreUntracked)
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, setCallable
private static final java.lang.String DEFAULT_REF
private java.lang.String stashRef
private boolean restoreIndex
private boolean restoreUntracked
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 applythis
public StashApplyCommand ignoreRepositoryState(boolean willIgnoreRepositoryState)
willIgnoreRepositoryState
- whether to ignore the repository state when applying the stashthis
private ObjectId getStashId() throws GitAPIException
GitAPIException
public 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>
GitAPIException
WrongRepositoryStateException
NoHeadException
StashApplyFailureException
@Deprecated public void setApplyIndex(boolean applyIndex)
setRestoreIndex(boolean)
insteadapplyIndex
- true (default) if the command should restore the index statepublic StashApplyCommand setRestoreIndex(boolean restoreIndex)
restoreIndex
- true (default) if the command should restore the index statethis
public StashApplyCommand setStrategy(MergeStrategy strategy)
MergeStrategy
to use.strategy
- The merge strategy to use in order to merge during this
command execution.this
@Deprecated public void setApplyUntracked(boolean applyUntracked)
setRestoreUntracked(boolean)
insteadapplyUntracked
- true (default) if the command should restore untracked filespublic StashApplyCommand setRestoreUntracked(boolean restoreUntracked)
restoreUntracked
- true (default) if the command should restore untracked filesthis
private void resetIndex(RevTree tree) throws java.io.IOException
java.io.IOException
private void resetUntracked(RevTree tree) throws CheckoutConflictException, java.io.IOException
CheckoutConflictException
java.io.IOException
private void checkoutPath(DirCacheEntry entry, ObjectReader reader, DirCacheCheckout.CheckoutMetadata checkoutMetadata)