Package pl.project13.core.jgit
Class DescribeResult
java.lang.Object
pl.project13.core.jgit.DescribeResult
Represents the result of a
git describe command.
See toString() for a detailed information how this result looks like.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDescribeResult(@NonNull String tagName) DescribeResult(@NonNull String tagName, boolean dirty, @NonNull Optional<String> dirtyMarker) DescribeResult(@NonNull org.eclipse.jgit.lib.ObjectReader objectReader, String tagName, int commitsAwayFromTag, @NonNull org.eclipse.jgit.lib.ObjectId commitId) DescribeResult(@NonNull org.eclipse.jgit.lib.ObjectReader objectReader, String tagName, int commitsAwayFromTag, org.eclipse.jgit.lib.ObjectId commitId, boolean dirty, String dirtyMarker) DescribeResult(@NonNull org.eclipse.jgit.lib.ObjectReader objectReader, String tagName, int commitsAwayFromTag, org.eclipse.jgit.lib.ObjectId commitId, boolean dirty, Optional<String> dirtyMarker, boolean forceLongFormat) DescribeResult(@NonNull org.eclipse.jgit.lib.ObjectReader objectReader, @NonNull org.eclipse.jgit.lib.ObjectId commitId) DescribeResult(@NonNull org.eclipse.jgit.lib.ObjectReader objectReader, @NonNull org.eclipse.jgit.lib.ObjectId commitId, boolean dirty, @NonNull Optional<String> dirtyMarker) -
Method Summary
Modifier and TypeMethodDescription@Nullable org.eclipse.jgit.lib.ObjectId@Nullable String@Nullable String@Nullable StringThe (possibly) "g" prefixed abbreviated object id of a commit.@Nullable Stringtag()toString()The format of a describe result is defined as:@NonNull DescribeResultwithCommitIdAbbrev(int n)
-
Field Details
-
EMPTY
-
-
Constructor Details
-
DescribeResult
-
DescribeResult
public DescribeResult(@NonNull org.eclipse.jgit.lib.ObjectReader objectReader, String tagName, int commitsAwayFromTag, @NonNull org.eclipse.jgit.lib.ObjectId commitId) -
DescribeResult
public DescribeResult(@NonNull org.eclipse.jgit.lib.ObjectReader objectReader, @NonNull org.eclipse.jgit.lib.ObjectId commitId) -
DescribeResult
-
DescribeResult
-
DescribeResult
-
DescribeResult
-
-
Method Details
-
withCommitIdAbbrev
-
toString
The format of a describe result is defined as: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), seeman 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. -
commitsAwayFromTag
-
dirtyMarker
-
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().- Returns:
- The (possibly) "g" prefixed abbreviated object id of a commit.
-
commitObjectId
public @Nullable org.eclipse.jgit.lib.ObjectId commitObjectId() -
tag
-