[PATCH] D111273: [clang-format-diff] Fix missing formatting for zero length git diff lines

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 7 10:48:46 PDT 2021


zequanwu added a comment.

In D111273#3047759 <https://reviews.llvm.org/D111273#3047759>, @hans wrote:

> Are there no tests for clang-format-diff.py? That seems unfortunate.

No test for clang-format-diff.py.

> Will this handle more nested cases, for example if the first line here is deleted, will we fix the indent of both "if (b)" and "c"?
>
>   if (a)
>     if (b)
>       c;
>
> I worry that this might be a tricky problem..

It handles this. Because `git diff -U0` gives 0 context lines, deleting lines will always gives 0 line_count.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111273/new/

https://reviews.llvm.org/D111273



More information about the cfe-commits mailing list