java.lang.Object | ||
↳ | java.lang.Enum<E extends java.lang.Enum<E>> | |
↳ | com.atlassian.bitbucket.scm.git.GitRefPattern |
Enumeration of standard git ref patterns, with additional logic to help apply standard git precedence and to produce both qualified and unqualified refs for given input.
Enum Values | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GitRefPattern | HEADS | Ref pattern denoting local branches. | |||||||||
GitRefPattern | PULL_REQUESTS | Ref pattern denoting open pull requests. | |||||||||
GitRefPattern | REMOTES | Ref pattern denoting remote branches (agnostic of remote name). | |||||||||
GitRefPattern | TAGS | Ref pattern denoting tags. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieves the components that make up this pattern's
path . | |||||||||||
Retrieves the path under the
.git directory containing all refs for this pattern. | |||||||||||
Retrieves a refspec for this pattern.
| |||||||||||
Retrieves a non-force refspec for this pattern.
| |||||||||||
Applies the git precedence ordering for the provided ref, constrained by this pattern, to produce an ordered list
of search candidates.
| |||||||||||
Qualifies the provided
ref according this pattern. | |||||||||||
Retrieves a flag that may be provided to the
git rev-list --sort= option to sort refs in the specified
order . | |||||||||||
Unqualifies the provided
ref according to this pattern. | |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieves the default sort flag, to be applied to refs when no more-specific sort is desired (or makes sense).
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Enum
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Comparable
|
Ref pattern denoting remote branches (agnostic of remote name).
Retrieves the components that make up this pattern's path
.
Retrieves the path under the .git
directory containing all refs for this pattern.
Note: Paths returned from this method will always end with a trailing /
.
Retrieves a refspec for this pattern. optionally including a leading +
to allow forced updates. The
refspec is structured so that all refs that match this pattern on the remote will update refs of the same
pattern locally. For example, for HEADS
, the refspec will be +refs/heads/*:refs/heads/*
if
force
is true
, and refs/heads/*:refs/heads/*
otherwise.
Retrieves a non-force refspec for this pattern. The refspec is structured so that all refs that match
this pattern on the remote will update refs of the same pattern locally. For example, for HEADS
, the
refspec will be refs/heads/*:refs/heads/*
.
Applies the git precedence ordering for the provided ref, constrained by this pattern, to produce an ordered list
of search candidates. That means that where the git precedence would search across branches and tags and remotes,
the returned list only searches within a given type, such as tags, but it contains paths under the .git
directory in the same order git
would search them.
ref | the ref for which to build a search order |
---|
IllegalArgumentException | if the provided ref is empty or blank |
---|---|
NullPointerException | if the provided ref is null
|
Qualifies the provided ref
according this pattern. The returned value is suitable for use as a ref's
ID
.
Note: The implementation of this method attempts to detect when a fully- or partially-qualified ref is
passed and further qualify the ref as appropriate. However, this may result in incorrect output when qualifying
a ref that looks fully- or partially-qualified but actually isn't. For example, qualifying a ref
like "refs/heads/master"
will produce the same string, from the HEADS
pattern, which is wrong
if the branch's display name was actually "refs/heads/master"
, meaning the qualified ref is
actually "refs/heads/refs/heads/master"
.
ref | the ref to qualify, which may be fully- or partially-qualified |
---|
IllegalArgumentException | if the provided ref is empty or blank |
---|---|
NullPointerException | if the provided ref is null
|
Retrieves a flag that may be provided to the git rev-list --sort=
option to sort refs in the specified
order
.
order | the order to apply to refs |
---|
git rev-list --sort=
flag for producing the specified order
Unqualifies the provided ref
according to this pattern. The returned value is suitable for use as a
ref's display ID
.
This process is the logical negation of qualifying a ref
. It removes the path for
this pattern from the provided ref
if it is present. If the provided ref is partially-qualified,
the partial qualification is removed.
Examples, using the HEADS
pattern:
"refs/heads/master"
-> "master"
"heads/master"
-> "master"
"master"
-> "master"
"refs/tags/some-tag"
-> "refs/tags/some-tag"
tag
, the provided ref
is returned unchanged.
As with qualifying a ref
, unqualifying a ref may produce incorrect results when provided
a ref that looks fully- or partially-qualified but actually isn't. For example, if the head in the
second example above was actually "heads/master"
(meaning its fully-qualified name would be
"refs/heads/heads/master"
), the unqualified name "master"
would be incorrect.
ref | the ref to unqualify, which may be fully- or partially-qualified |
---|
IllegalArgumentException | if the provided ref is empty or blank |
---|---|
NullPointerException | if the provided ref is null
|
Retrieves the default sort flag, to be applied to refs when no more-specific sort is desired (or makes sense).