Package pl.project13.core.jgit
Class DescribeCommand
java.lang.Object
org.eclipse.jgit.api.GitCommand<DescribeResult>
pl.project13.core.jgit.DescribeCommand
- All Implemented Interfaces:
Callable<DescribeResult>
Implements git's
describecommand.
-
Field Summary
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo -
Method Summary
Modifier and TypeMethodDescription--abbrev=Nalways(boolean always) --alwaysapply(GitDescribeConfig config) Apply all configuration options passed in with `config`.call()--dirty[=mark]forceLongFormat(Boolean forceLongFormat) --long--match glob-patternstatic DescribeCommandon(String evaluateOnCommit, org.eclipse.jgit.lib.Repository repo, LogInterface log) Creates a new describe command which interacts with a single repositorytags()Alias fortags(Boolean)with true value--tagsMethods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Method Details
-
on
@Nonnull public static DescribeCommand on(String evaluateOnCommit, org.eclipse.jgit.lib.Repository repo, LogInterface log) Creates a new describe command which interacts with a single repository- Parameters:
evaluateOnCommit- the commit that should be used as reference to generate the properties fromrepo- theRepositorythis command should interact withlog- logger bridge to direct logs to- Returns:
- itself with the options set as specified by the arguments to allow fluent configuration
-
always
--always
Show uniquely abbreviated commit object as fallback.true
by default.- Parameters:
always- set to `true` when you want the describe command show uniquely abbreviated commit object as fallback.- Returns:
- itself with the `--always` option set as specified by the argument to allow fluent configuration
-
forceLongFormat
--long
Always output the long format (the tag, the number of commits and the abbreviated commit name) even when it matches a tag. This is useful when you want to see parts of the commit object name in "describe" output, even when the commit in question happens to be a tagged version. Instead of just emitting the tag name, it will describe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2 that points at object deadbee....).false
by default.- Parameters:
forceLongFormat- set to `true` if you always want to output the long format- Returns:
- itself with the `--long` option set as specified by the argument to allow fluent configuration
-
abbrev
--abbrev=N
Instead of using the default 7 hexadecimal digits as the abbreviated object name, use N digits, or as many digits as needed to form a unique object name. An `n` of 0 will suppress long format, only showing the closest tag.- Parameters:
n- the length of the abbreviated object name- Returns:
- itself with the `--abbrev` option set as specified by the argument to allow fluent configuration
-
tags
--tags
Instead of using only the annotated tags, use any tag found in .git/refs/tags. This option enables matching a lightweight (non-annotated) tag.
Searching for lightweight tags is false by default.
Example:b6a73ed - (HEAD, master) d37a598 - (v1.0-fixed-stuff) - a lightweight tag (with no message) 9597545 - (v1.0) - an annotated tag $ git describe annotated-tag-2-gb6a73ed # the nearest "annotated" tag is found $ git describe --tags lightweight-tag-1-gb6a73ed # the nearest tag (including lightweights) is foundUsing only annotated tags to mark builds may be useful if you're using tags to help yourself with annotating things like "i'll get back to that" etc - you don't need such tags to be exposed. But if you want lightweight tags to be included in the search, enable this option.
- Parameters:
includeLightweightTagsInSearch- set to `true` if you want to matching a lightweight (non-annotated) tag- Returns:
- itself with the `--tags` option set as specified by the argument to allow fluent configuration
-
tags
Alias fortags(Boolean)with true value- Returns:
- itself with the `--tags` option set to `true` to allow fluent configuration
-
apply
Apply all configuration options passed in with `config`. If a setting is null, it will not be applied - so for abbrev for example, the default 7 would be used.- Parameters:
config- A configuration that shall be applied to the current one- Returns:
- itself, after applying the settings
-
dirty
--dirty[=mark]
Describe the working tree. It means describe HEAD and appends mark (-dirty
by default) if the working tree is dirty.- Parameters:
dirtyMarker- the marker name to be appended to the describe output when the workspace is dirty- Returns:
- itself with the `--dirty` option set as specified by the argument to allow fluent configuration
-
match
--match glob-pattern
Consider only those tags which match the given glob pattern.- Parameters:
pattern- the glob style pattern to match against the tag names- Returns:
- itself with the `--match` option set as specified by the argument to allow fluent configuration
-
call
- Specified by:
callin interfaceCallable<DescribeResult>- Specified by:
callin classorg.eclipse.jgit.api.GitCommand<DescribeResult>- Throws:
org.eclipse.jgit.api.errors.GitAPIException
-