Package org.eclipse.jgit.api
Class StashCreateCommand
Command class to stash changes in the working directory and index in a
commit.
- Since:
- 2.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private String
private static final String
private static final String
private static final String
private PersonIdent
private String
private String
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
ConstructorsConstructorDescriptionStashCreateCommand
(Repository repo) Create a command to stash changes in the working directory and index -
Method Summary
Modifier and TypeMethodDescriptioncall()
private CommitBuilder
private Ref
getHead()
private RevCommit
parseCommit
(ObjectReader reader, ObjectId headId) setIncludeUntracked
(boolean includeUntracked) Whether to include untracked files in the stash.setIndexMessage
(String message) Set the message used when committing index changessetPerson
(PersonIdent person) Set the person to use as the author and committer in the commits madeSet the reference to update with the stashed commit id If null, no reference is updatedsetWorkingDirectoryMessage
(String message) Set the message used when committing working directory changesprivate void
updateStashRef
(ObjectId commitId, PersonIdent refLogIdent, String refLogMessage) Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
MSG_INDEX
- See Also:
-
MSG_UNTRACKED
- See Also:
-
MSG_WORKING_DIR
- See Also:
-
indexMessage
-
workingDirectoryMessage
-
ref
-
person
-
includeUntracked
private boolean includeUntracked
-
-
Constructor Details
-
StashCreateCommand
Create a command to stash changes in the working directory and index- Parameters:
repo
- aRepository
object.
-
-
Method Details
-
setIndexMessage
Set the message used when committing index changesThe message will be formatted with the current branch, abbreviated commit id, and short commit message when used.
- Parameters:
message
- the stash message- Returns:
this
-
setWorkingDirectoryMessage
Set the message used when committing working directory changesThe message will be formatted with the current branch, abbreviated commit id, and short commit message when used.
- Parameters:
message
- the working directory message- Returns:
this
-
setPerson
Set the person to use as the author and committer in the commits made- Parameters:
person
- thePersonIdent
of the person who creates the stash.- Returns:
this
-
setRef
Set the reference to update with the stashed commit id If null, no reference is updatedThis value defaults to
Constants.R_STASH
- Parameters:
ref
- the name of theRef
to update- Returns:
this
-
setIncludeUntracked
Whether to include untracked files in the stash.- Parameters:
includeUntracked
- whether to include untracked files in the stash- Returns:
this
- Since:
- 3.4
-
parseCommit
- Throws:
IOException
-
createBuilder
-
updateStashRef
private void updateStashRef(ObjectId commitId, PersonIdent refLogIdent, String refLogMessage) throws IOException - Throws:
IOException
-
getHead
- Throws:
GitAPIException
-
call
Execute the command
Stash the contents on the working directory and index in separate commits and reset to the current HEAD commit.
- Specified by:
call
in interfaceCallable<RevCommit>
- Specified by:
call
in classGitCommand<RevCommit>
- Throws:
GitAPIException
-