public class TagCommand extends GitCommand<Ref>
Examples (git
is a Git
instance):
Create a new tag for the current commit:
git.tag().setName("v1.0").setMessage("First stable release").call();
Create a new unannotated tag for the current commit:
git.tag().setName("v1.0").setAnnotated(false).call();
repo
Modifier | Constructor and Description |
---|---|
protected |
TagCommand(Repository repo)
Constructor for TagCommand.
|
Modifier and Type | Method and Description |
---|---|
Ref |
call() |
String |
getMessage()
Get the tag
message . |
String |
getName()
Get the tag
name . |
RevObject |
getObjectId()
Get the tag's object id
|
String |
getSigningKey()
Retrieves the signing key ID.
|
PersonIdent |
getTagger()
Get the
tagger who created the tag. |
boolean |
isAnnotated()
Whether this will create an annotated tag.
|
boolean |
isForceUpdate()
Whether this is a forced update
|
boolean |
isSigned()
Whether
setSigned(true) has been called or
whether a signing key ID has been set;
i.e., whether -s or -u was specified explicitly. |
TagCommand |
setAnnotated(boolean annotated)
Configure this tag to be created as an annotated tag
|
TagCommand |
setCredentialsProvider(CredentialsProvider credentialsProvider)
Sets a
CredentialsProvider |
TagCommand |
setForceUpdate(boolean forceUpdate)
If set to true the Tag command may replace an existing tag object.
|
TagCommand |
setGpgConfig(GpgConfig config)
Sets an external
GpgConfig to use. |
TagCommand |
setGpgSigner(GpgObjectSigner signer)
Sets the
GpgSigner to use if the commit is to be signed. |
TagCommand |
setMessage(String message)
Set the tag
message . |
TagCommand |
setName(String name)
Set the tag
name . |
TagCommand |
setObjectId(RevObject id)
Sets the object id of the tag.
|
TagCommand |
setSigned(boolean signed)
If set to true the Tag command creates a signed tag object.
|
TagCommand |
setSigningKey(String signingKey)
Sets the signing key.
|
TagCommand |
setTagger(PersonIdent tagger)
Sets the tagger of the tag.
|
checkCallable, getRepository, setCallable
protected TagCommand(Repository repo)
Constructor for TagCommand.
repo
- a Repository
object.public Ref call() throws GitAPIException, ConcurrentRefUpdateException, InvalidTagNameException, NoHeadException
Execute the command
Executes the tag
command with all the options and parameters
collected by the setter methods of this class. Each instance of this
class should only be used for one invocation of the command (means: one
call to call()
)
call
in interface Callable<Ref>
call
in class GitCommand<Ref>
GitAPIException
ConcurrentRefUpdateException
InvalidTagNameException
NoHeadException
public TagCommand setName(String name)
name
.name
- the tag name used for the tag
this
public String getName()
name
.tag
public String getMessage()
message
.tag
public TagCommand setMessage(String message)
message
.message
- the tag message used for the tag
this
public boolean isSigned()
setSigned(true)
has been called or
whether a signing key ID
has been set;
i.e., whether -s or -u was specified explicitly.public TagCommand setSigned(boolean signed)
If true
, the tag will be a signed annotated tag.
signed
- whether to signthis
public TagCommand setGpgSigner(GpgObjectSigner signer)
GpgSigner
to use if the commit is to be signed.signer
- to use; if null
, the default signer will be usedthis
public TagCommand setGpgConfig(GpgConfig config)
GpgConfig
to use. Whether it will be used is at
the discretion of the setGpgSigner(GpgObjectSigner)
.config
- to set; if null
, the config will be loaded from the
git config of the repositorythis
public TagCommand setTagger(PersonIdent tagger)
tagger
- a PersonIdent
object.this
public PersonIdent getTagger()
tagger
who created the tag.public RevObject getObjectId()
public TagCommand setObjectId(RevObject id)
null
, the
commit pointed to from HEAD will be used.id
- a RevObject
object.this
public boolean isForceUpdate()
public TagCommand setForceUpdate(boolean forceUpdate)
forceUpdate
- whether this is a forced updatethis
public TagCommand setAnnotated(boolean annotated)
annotated
- whether this shall be an annotated tagthis
public boolean isAnnotated()
public TagCommand setSigningKey(String signingKey)
Per spec of user.signingKey
: this will be sent to the GPG program
as is, i.e. can be anything supported by the GPG program.
Note, if none was set or null
is specified a default will be
obtained from the configuration.
If set to a non-null
value, the tag will be a signed annotated
tag.
signingKey
- signing key; null
allowedthis
public String getSigningKey()
null
if none is setpublic TagCommand setCredentialsProvider(CredentialsProvider credentialsProvider)
CredentialsProvider
credentialsProvider
- the provider to use when querying for credentials (eg., during
signing)this
Copyright © 2021 Eclipse JGit Project. All rights reserved.