public class DescribeCommand extends GitCommand<java.lang.String>
Modifier and Type | Field and Description |
---|---|
private boolean |
longDesc
Whether to always use long output format or not.
|
private java.util.List<IMatcher> |
matchers
Pattern matchers to be applied to tags under consideration
|
private int |
maxCandidates
How many tags we'll consider as candidates.
|
private RevCommit |
target
Commit to describe.
|
private RevWalk |
w |
repo
Modifier | Constructor and Description |
---|---|
protected |
DescribeCommand(Repository repo)
Constructor for DescribeCommand.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
call() |
private java.util.Optional<Ref> |
getBestMatch(java.util.List<Ref> tags) |
private ObjectId |
getObjectIdFromRef(Ref r) |
private java.lang.String |
longDescription(Ref tag,
int depth,
ObjectId tip) |
DescribeCommand |
setLong(boolean longDesc)
Determine whether always to use the long format or not.
|
DescribeCommand |
setMatch(java.lang.String... patterns)
Sets one or more
glob(7) patterns that tags must match to be
considered. |
DescribeCommand |
setTarget(ObjectId target)
Sets the commit to be described.
|
DescribeCommand |
setTarget(java.lang.String rev)
Sets the commit to be described.
|
checkCallable, getRepository, setCallable
private final RevWalk w
private RevCommit target
private int maxCandidates
private boolean longDesc
private java.util.List<IMatcher> matchers
protected DescribeCommand(Repository repo)
repo
- the Repository
public DescribeCommand setTarget(ObjectId target) throws java.io.IOException
target
- A non-null object ID to be described.this
MissingObjectException
- the supplied commit does not exist.IncorrectObjectTypeException
- the supplied id is not a commit or an annotated tag.java.io.IOException
- a pack file or loose object could not be read.public DescribeCommand setTarget(java.lang.String rev) throws java.io.IOException, RefNotFoundException
rev
- Commit ID, tag, branch, ref, etc. See
Repository.resolve(String)
for
allowed syntax.this
IncorrectObjectTypeException
- the supplied id is not a commit or an annotated tag.RefNotFoundException
- the given rev didn't resolve to any object.java.io.IOException
- a pack file or loose object could not be read.public DescribeCommand setLong(boolean longDesc)
true
the long format is used even the commit matches a tag.longDesc
- true
if always the long format should be used.this
private java.lang.String longDescription(Ref tag, int depth, ObjectId tip) throws java.io.IOException
java.io.IOException
public DescribeCommand setMatch(java.lang.String... patterns) throws InvalidPatternException
glob(7)
patterns that tags must match to be
considered. If multiple patterns are provided, tags only need match one
of them.patterns
- the glob(7)
pattern or patternsthis
InvalidPatternException
- if the pattern passed in was invalid.public java.lang.String call() throws GitAPIException
Execute the command
Describes the specified commit. Target defaults to HEAD if no commit was set explicitly.
call
in interface java.util.concurrent.Callable<java.lang.String>
call
in class GitCommand<java.lang.String>
GitAPIException