I need to generate a full-context git diff programmatically for a web ui.
A CLI for generating a full-context diff was covered in questions:
If you just use a large number with -U, you could choose the large number to be the point at which your application can't handle displaying such a large file (diff).
it's a correctness issue if my file is larger than 1M lines
And to address this issue, you can check the output for more than one @@ ... @@ line to determine whether it's complete — this allows you to avoid silently giving a wrong number.