Description
Parse one unified-diff range field.
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 unified-diff range field.
When to use this tool
Use Development: Unified Diff Range Field Split 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 result. Expand result to inspect the returned fields.
Parse one unified-diff range field. Accept + or -, 1-9-digit start and optional comma plus 1-9-digit count; omitted count defaults to one; return old side for minus and new for plus.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| token | Token | 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.start | Start | Calculated result member: number. |
| result.count | Count | Calculated result member: number. |
| result.side | Side | Calculated result member: string. |
{
"input": {
"token": "-12,0"
},
"output": {
"result": {
"start": 12,
"count": 0,
"side": "old"
}
}
} Limitations and assumptions
- Leading zeros and count zero are accepted; this does not validate a whole hunk or apply changes.
- 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
- Development: Unified Diff No Newline Marker
Recognize a no-newline marker and classify its previous diff line.
- Git Diff Status Rename Percentage
Parse a rename or copy status with similarity percent.