public class DescribeResult extends Object
git describe command.
See toString() for a detailed information how this result looks like.| Modifier and Type | Field and Description |
|---|---|
static DescribeResult |
EMPTY |
| Constructor and Description |
|---|
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
org.eclipse.jgit.lib.ObjectId commitId) |
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
com.google.common.base.Optional<String> dirtyMarker) |
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId) |
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
com.google.common.base.Optional<String> dirtyMarker,
boolean forceLongFormat) |
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
String dirtyMarker) |
DescribeResult(String tagName) |
DescribeResult(String tagName,
boolean dirty,
com.google.common.base.Optional<String> dirtyMarker) |
| Modifier and Type | Method and Description |
|---|---|
org.eclipse.jgit.lib.ObjectId |
commitObjectId() |
String |
commitsAwayFromTag() |
String |
dirtyMarker() |
String |
prefixedCommitId()
The (possibly) "g" prefixed abbriverated object id of a commit.
|
String |
tag() |
String |
toString()
The format of a describe result is defined as:
|
DescribeResult |
withCommitIdAbbrev(int n) |
public static final DescribeResult EMPTY
public DescribeResult(@NotNull
String tagName)
public DescribeResult(@NotNull
org.eclipse.jgit.lib.ObjectReader objectReader,
String tagName,
int commitsAwayFromTag,
@Nullable
org.eclipse.jgit.lib.ObjectId commitId)
public DescribeResult(@NotNull
org.eclipse.jgit.lib.ObjectReader objectReader,
@NotNull
org.eclipse.jgit.lib.ObjectId commitId)
public DescribeResult(@NotNull
org.eclipse.jgit.lib.ObjectReader objectReader,
String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
String dirtyMarker)
public DescribeResult(@NotNull
org.eclipse.jgit.lib.ObjectReader objectReader,
String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
com.google.common.base.Optional<String> dirtyMarker,
boolean forceLongFormat)
public DescribeResult(@NotNull
org.eclipse.jgit.lib.ObjectReader objectReader,
@NotNull
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
@NotNull
com.google.common.base.Optional<String> dirtyMarker)
@NotNull public DescribeResult withCommitIdAbbrev(int n)
public String toString()
v1.0.4-14-g2414721-DEV ^ ^ ^ ^ | | | |-- if a dirtyMarker was given, it will appear here if the repository is in "dirty" state | | |---------- the "g" prefixed commit id. The prefix is compatible with what git-describe would return - weird, but true. | |--------------- the number of commits away from the found tag. So "2414721" is 14 commits ahead of "v1.0.4", in this example. |-------------------- the "nearest" tag, to the mentioned commit.Other outputs may look like:
v1.0.4 -- if the repository is "on a tag"
v1.0.4-DEV -- if the repository is "on a tag", but in "dirty" state
2414721 -- a plain commit id hash if not tags were defined (of determined "near" this commit).
It does NOT include the "g" prefix, that is used in the "full" describe output format!
For more details (on when what output will be returned etc), see man git-describe.
In general, you can assume it's a "best effort" approach, to give you as much info about the repo state as possible.@Nullable public String commitsAwayFromTag()
@Nullable public String dirtyMarker()
@Nullable public String prefixedCommitId()
The (possibly) "g" prefixed abbriverated object id of a commit.
The "g" prefix is prepended to be compatible with git's describe output, please refer to man git-describe to check why it's included.
The "g" prefix is used when a tag is defined on this result. If it's not, this method yields a plain commit id hash. This is following git's behaviour - so any git tooling should be happy with this output.
Notes about the abbriverated object id:
Git will try to use your given abbrev lenght, but when it's to short to guarantee uniqueness -
a longer one will be used (which WILL guarantee uniqueness).
If you need the full commit id, it's always available via commitObjectId().
@Nullable public org.eclipse.jgit.lib.ObjectId commitObjectId()
@Nullable public String tag()
Copyright © 2014. All Rights Reserved.