public class StashCreateCommand extends GitCommand<RevCommit>
Modifier and Type | Field and Description |
---|---|
private boolean |
includeUntracked |
private java.lang.String |
indexMessage |
private static java.lang.String |
MSG_INDEX |
private static java.lang.String |
MSG_UNTRACKED |
private static java.lang.String |
MSG_WORKING_DIR |
private PersonIdent |
person |
private java.lang.String |
ref |
private java.lang.String |
workingDirectoryMessage |
repo
Constructor and Description |
---|
StashCreateCommand(Repository repo)
Create a command to stash changes in the working directory and index
|
Modifier and Type | Method and Description |
---|---|
RevCommit |
call() |
private CommitBuilder |
createBuilder() |
private Ref |
getHead() |
private RevCommit |
parseCommit(ObjectReader reader,
ObjectId headId) |
StashCreateCommand |
setIncludeUntracked(boolean includeUntracked)
Whether to include untracked files in the stash.
|
StashCreateCommand |
setIndexMessage(java.lang.String message)
Set the message used when committing index changes
|
StashCreateCommand |
setPerson(PersonIdent person)
Set the person to use as the author and committer in the commits made
|
StashCreateCommand |
setRef(java.lang.String ref)
Set the reference to update with the stashed commit id If null, no
reference is updated
|
StashCreateCommand |
setWorkingDirectoryMessage(java.lang.String message)
Set the message used when committing working directory changes
|
private void |
updateStashRef(ObjectId commitId,
PersonIdent refLogIdent,
java.lang.String refLogMessage) |
checkCallable, getRepository, setCallable
private static final java.lang.String MSG_INDEX
private static final java.lang.String MSG_UNTRACKED
private static final java.lang.String MSG_WORKING_DIR
private java.lang.String indexMessage
private java.lang.String workingDirectoryMessage
private java.lang.String ref
private PersonIdent person
private boolean includeUntracked
public StashCreateCommand(Repository repo)
repo
- a Repository
object.public StashCreateCommand setIndexMessage(java.lang.String message)
The message will be formatted with the current branch, abbreviated commit id, and short commit message when used.
message
- the stash messagethis
public StashCreateCommand setWorkingDirectoryMessage(java.lang.String message)
The message will be formatted with the current branch, abbreviated commit id, and short commit message when used.
message
- the working directory messagethis
public StashCreateCommand setPerson(PersonIdent person)
person
- the PersonIdent
of the person who
creates the stash.this
public StashCreateCommand setRef(java.lang.String ref)
This value defaults to Constants.R_STASH
ref
- the name of the Ref
to updatethis
public StashCreateCommand setIncludeUntracked(boolean includeUntracked)
includeUntracked
- whether to include untracked files in the stashthis
private RevCommit parseCommit(ObjectReader reader, ObjectId headId) throws java.io.IOException
java.io.IOException
private CommitBuilder createBuilder()
private void updateStashRef(ObjectId commitId, PersonIdent refLogIdent, java.lang.String refLogMessage) throws java.io.IOException
java.io.IOException
private Ref getHead() throws GitAPIException
GitAPIException
public RevCommit call() throws GitAPIException
Execute the command
Stash the contents on the working directory and index in separate commits and reset to the current HEAD commit.
call
in interface java.util.concurrent.Callable<RevCommit>
call
in class GitCommand<RevCommit>
GitAPIException