Skip to content

Main content

Development: Unified Diff No Newline Marker Tool

Recognize the exact unified-diff no-final-newline marker and identify the side of its supplied preceding hunk line; no complete diff parsing.

Loading tool…

Description

Recognize a no-newline marker and classify its previous diff line.

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.

Recognize a no-newline marker and classify its previous diff line.

When to use this tool

Use Development: Unified Diff No Newline Marker when inspecting the stated bounded Git or patch token.

How to use the tool and how it works

  1. Enter marker, previousLine. 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.

Recognize a no-newline marker and classify its previous diff line. Require a previous line beginning space, + or - and no CR/LF in either input; exact marker equality sets recognized; previous prefix selects old/new/both.1

Input fieldMeaning and unitsAccepted input
markerMarkerRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
previousLinePrevious LineRequired. 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.recognizedRecognizedCalculated result member: boolean.
result.qualifiedSideQualified SideCalculated result member: string.
json
{
  "input": {
    "marker": "\\ No newline at end of file",
    "previousLine": "-abc"
  },
  "output": {
    "result": {
      "recognized": true,
      "qualifiedSide": "old"
    }
  }
}

Limitations and assumptions

  • qualifiedSide is still returned for an unrecognized marker; no patch is applied.
  • 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-no-newline-marker — tool.io

Similar or alternative tools