Description
Parse one parent or generation suffix on a revision token.
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.
Parse one parent or generation suffix on a revision token.
When to use this tool
Use Git Revision Parent Suffix Count when inspecting the stated bounded Git or patch token.
How to use the tool and how it works
- Enter token. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read revision, parent, generation. Use the output convention below.
Parse one parent or generation suffix on a revision token. Accept one ~ or ^ with up to eight digits, defaulting omitted count to one; return revision plus explicit parent/generation fields under that suffix rule.1
Git distinguishes parent selection with a caret from first-parent traversal with a tilde; the helper parses a suffix without resolving repository objects.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| token | Token | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| revision | Revision | Required. Text; maximum UTF-16 length 8192. |
| parent | Parsed parent selector; ^0 yields zero, while ~0 retains the local parent value 1. | Required. Safe integer. |
| generation | Parsed tilde count, or zero for a caret selector; no revision is resolved. | Required. Safe integer. |
{
"input": {
"token": "HEAD~3"
},
"output": {
"revision": "HEAD",
"parent": 1,
"generation": 3
}
} Limitations and assumptions
- Zero counts select the revision itself; this does not resolve commits or parse chained suffixes.
- 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 Revision Range Two Dot Token
Split a restricted two-dot Git revision range token.
- Git Reflog Selector Token
Parse a restricted ordinal Git reflog selector.