# split_diff_lines

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/diff_utils/split_diff_lines)

Split a unified diff back into the lines it was assembled from.

Deliberately not `splitlines()`. Every diff reaching this function is
`"\n"`-joined from lines that themselves came from `splitlines()` or
`split("\n")`, so no element can contain a line boundary and `"\n"` is the
exact inverse. `splitlines()` also breaks on `\r`, `\v`, `\f`, U+2028,
U+2029 and U+0085, which splits a single diff line into fragments. The tail
fragment carries no `+`/`-` marker, so it would render as an unmarked note —
on the approval prompt that means changed content shown as neutral metadata.

Check any new producer against that invariant rather than against a list of
the current ones.

## Signature

```python
split_diff_lines(
    diff: str,
) -> list[str]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `diff` | `str` | Yes | Unified diff string. |

## Returns

`list[str]`

The diff's lines, without a trailing empty entry for a terminating

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4bfa52000ef65ac623d8ada0cb67f67cbdd663ea/libs/code/deepagents_code/diff_utils.py#L94)