How to use haiku-format 17.0.1 with git

Now that haiku-format has been upgraded from 10.0.1 to 17.0.1 and made available in HaikuDepot, it’s time for a short demo.

I elided a pair of syntactically optional braces (which are nevertheless required by the Haiku coding style) in PoseView.cpp and ran git haiku-format to reformat only the diff (after creating a .haiku-format config file to override the default 100 ColumnLimit):

Below is the result:


Notice that not only did haiku-format put the braces back in, it also simplified the code by merging the outer else with the inner if-else chain!

Now you can commit the formatting changes:
screenshot3

Happy formatting!

13 Likes