Description
Split a supported full Git ref into kind and short name.
Git and diff tokens encode references, object metadata and patch coordinates. Parsing a local token does not resolve repository objects, establish identity or prove that a patch is complete or applicable.
Split a supported full Git ref into kind and short name.
When to use this tool
Use Development: Git Ref Short Name Prefix Split when inspecting the stated bounded Git or patch token.
How to use the tool and how it works
- Enter reference. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Split a supported full Git ref into kind and short name. Require refs/heads, refs/tags or refs/remotes and reject the implemented invalid characters, empty/dot-leading/.lock components, double dots, @{ and terminal dot.1
Git reference names have lexical restrictions. Parsing a plausible name does not establish an existing branch, tag or object.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| reference | Reference | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Returned object; expand its named members below. | Required. Object. |
| result.kind | Kind | Calculated result member: string. |
| result.shortName | Short Name | Calculated result member: string. |
{
"input": {
"reference": "refs/heads/feature/a"
},
"output": {
"result": {
"kind": "branch",
"shortName": "feature/a"
}
}
} Limitations and assumptions
- This is syntax inspection, not ref existence, branch resolution or repository access.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Use Git itself against the intended repository for object resolution, complete validation, history interpretation or patch application.
References
Similar or alternative tools
- Git Pathspec Magic Prefix Token
Split a long-form pathspec magic prefix from its pattern.
- Git Reflog Selector Token
Parse a restricted ordinal Git reflog selector.