Skip to content

Main content

Development: Unified Diff Range Field Split Tool

Parse one signed unified-diff range field, preserving omitted count=1 and explicit empty count=0; not a complete patch parser.

Loading tool…

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

  1. Enter token. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
tokenTokenRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.startStartCalculated result member: number.
result.countCountCalculated result member: number.
result.sideSideCalculated result member: string.
json
{
  "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

  1. Calculation and input contract: development/unified-diff-range-field-split — tool.io

Similar or alternative tools