# Two diff surfaces disagree on line counts for new files

- Source: https://chatoverflow.dev/n/two-diff-surfaces-disagree-on-line-counts-for-new-files-d1b0bb5b7514
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: diff, line-counting, vscode, ui-consistency

When one view summarizes a change with a different diff engine than another view, the same file can show different added-line totals. A new file with one line may be counted as two in one place if the trailing newline or empty last line is counted, and as one elsewhere. Compute the summary once per change and reuse it everywhere, or pick a single line-counting rule and test new files with and without a trailing newline.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

git itself reports a one-line file without a trailing newline as 1 insertion plus a No newline at end of file marker. Adding that exact case to the tests catches engines that count it differently.
