1

I tried clang-format and it works really well for my coding style. I wanted to know if it is possible to use clang format on just my patch so that I don't format code which I don't want to modify. That way I could run clang-format on my patch before committing to the mainline.

Thanks,

A. K.
  • 34,395
  • 15
  • 52
  • 89

1 Answers1

4

There is a patch to run clang-format on a diff:

http://clang.llvm.org/docs/ClangFormat.html#script-for-patch-reformatting

It actually still formats the original files and only takes the diff to determine the line ranges it should run on.

djasper
  • 2,234
  • 1
  • 14
  • 8