public class DescribeResult
extends java.lang.Object
git describe command.
See toString() for a detailed information how this result looks like.| Modifier and Type | Field | Description |
|---|---|---|
static DescribeResult |
EMPTY |
| Constructor | Description |
|---|---|
DescribeResult(java.lang.String tagName) |
|
DescribeResult(java.lang.String tagName,
boolean dirty,
java.util.Optional<java.lang.String> dirtyMarker) |
|
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
java.lang.String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId) |
|
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
java.lang.String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
java.lang.String dirtyMarker) |
|
DescribeResult(org.eclipse.jgit.lib.ObjectReader objectReader,
java.lang.String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
java.util.Optional<java.lang.String> dirtyMarker,
boolean forceLongFormat) |
|
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,
java.util.Optional<java.lang.String> dirtyMarker) |
| Modifier and Type | Method | Description |
|---|---|---|
org.eclipse.jgit.lib.ObjectId |
commitObjectId() |
|
java.lang.String |
commitsAwayFromTag() |
|
java.lang.String |
dirtyMarker() |
|
java.lang.String |
prefixedCommitId() |
The (possibly) "g" prefixed abbreviated object id of a commit.
|
java.lang.String |
tag() |
|
java.lang.String |
toString() |
The format of a describe result is defined as:
|
DescribeResult |
withCommitIdAbbrev(int n) |
public static final DescribeResult EMPTY
public DescribeResult(@Nonnull
java.lang.String tagName)
public DescribeResult(@Nonnull
org.eclipse.jgit.lib.ObjectReader objectReader,
java.lang.String tagName,
int commitsAwayFromTag,
@Nonnull
org.eclipse.jgit.lib.ObjectId commitId)
public DescribeResult(@Nonnull
org.eclipse.jgit.lib.ObjectReader objectReader,
@Nonnull
org.eclipse.jgit.lib.ObjectId commitId)
public DescribeResult(@Nonnull
org.eclipse.jgit.lib.ObjectReader objectReader,
java.lang.String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
java.lang.String dirtyMarker)
public DescribeResult(@Nonnull
org.eclipse.jgit.lib.ObjectReader objectReader,
java.lang.String tagName,
int commitsAwayFromTag,
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
java.util.Optional<java.lang.String> dirtyMarker,
boolean forceLongFormat)
public DescribeResult(@Nonnull
org.eclipse.jgit.lib.ObjectReader objectReader,
@Nonnull
org.eclipse.jgit.lib.ObjectId commitId,
boolean dirty,
@Nonnull
java.util.Optional<java.lang.String> dirtyMarker)
public DescribeResult(@Nonnull
java.lang.String tagName,
boolean dirty,
@Nonnull
java.util.Optional<java.lang.String> dirtyMarker)
@Nonnull public DescribeResult withCommitIdAbbrev(int n)
public java.lang.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.toString in class java.lang.Object@Nullable public java.lang.String commitsAwayFromTag()
@Nullable public java.lang.String dirtyMarker()
@Nullable public java.lang.String prefixedCommitId()
The (possibly) "g" prefixed abbreviated 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 abbreviated object id:
Git will try to use your given abbrev length, but when it's too 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 java.lang.String tag()
Copyright © 2020. All Rights Reserved.