Files
Fangrui Song 5340f7cc88 [git-clang-format] Don't format the line preceding a deletion (#215946)
`git diff -U0` renders a pure deletion as `@@ -3,3 +2,0 @@`: no new
lines,
anchored at the preceding line. extract_lines coerces that zero count to
one, so clang-format reformats a line the deletion never touched.

Skip such hunks, matching clang-format-diff.py. start_line is 0 only for
deletions at the start of a file, so that check goes away as well.

Aided by Claude Opus 5

(cherry picked from commit fe0143b1a97484e10bc11b012ceb2c1ecd8bc38c)
2026-09-01 10:28:34 +02:00
..