Package org.eclipse.jgit.api
Class StashDropCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<ObjectId>
-
- org.eclipse.jgit.api.StashDropCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<ObjectId>
public class StashDropCommand extends GitCommand<ObjectId>
Command class to delete a stashed commit referenceCurrently only supported on a traditional file repository using one-file-per-ref reflogs.
- Since:
- 2.0
- See Also:
- Git documentation about Stash
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
all
private int
stashRefEntry
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Constructor Description StashDropCommand(Repository repo)
Constructor for StashDropCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectId
call()
private RefUpdate
createRefUpdate(Ref stashRef)
private void
deleteRef(Ref stashRef)
private Ref
getRef()
StashDropCommand
setAll(boolean all)
Set whether to drop all stashed commitsStashDropCommand
setStashRef(int stashRef)
Set the stash reference to drop (0-based).private void
updateRef(Ref stashRef, ObjectId newId)
-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
StashDropCommand
public StashDropCommand(Repository repo)
Constructor for StashDropCommand.- Parameters:
repo
- aRepository
object.
-
-
Method Detail
-
setStashRef
public StashDropCommand setStashRef(int stashRef)
Set the stash reference to drop (0-based).This will default to drop the latest stashed commit (stash@{0}) if unspecified
- Parameters:
stashRef
- the 0-based index of the stash reference- Returns:
this
-
setAll
public StashDropCommand setAll(boolean all)
Set whether to drop all stashed commits- Parameters:
all
-true
to drop all stashed commits,false
to drop only the stashed commit set via callingsetStashRef(int)
- Returns:
this
-
getRef
private Ref getRef() throws GitAPIException
- Throws:
GitAPIException
-
createRefUpdate
private RefUpdate createRefUpdate(Ref stashRef) throws java.io.IOException
- Throws:
java.io.IOException
-
deleteRef
private void deleteRef(Ref stashRef)
-
call
public ObjectId call() throws GitAPIException
Execute the command
Drop the configured entry from the stash reflog and return value of the stash reference after the drop occurs
- Specified by:
call
in interfacejava.util.concurrent.Callable<ObjectId>
- Specified by:
call
in classGitCommand<ObjectId>
- Throws:
GitAPIException
-
-