Am Sa., 9. März 2019 um 13:54 Uhr schrieb MyDeveloper Day <mydeveloper...@gmail.com>: > > Yes ideally I'd agree, It also says: > > > Avoid committing formatting- or whitespace-only changes outside of code you > > plan to make subsequent changes to. > > This was getting to be a problem, every time we edited the file (with > auto-clang-format) a large number of other changes would also get made, > presumably because others hadn't been clang-formatting their commits > correctly! we'd have to merge out a lot of changes everytime.
This is the same motivation behind r338291 which motivated adding this developer policy (see http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180730/236802.html). I use "git clang-format origin/master" to only reformat lines that I touched. > >Also, try to separate formatting or whitespace changes from functional > >changes, either by correcting the format first (ideally) or afterward > > which means you want those changes to be separate commits.. so ideally its > better we clang-format the file when there is no other related changes so > future revisions don't need to have a mixture of real changes and whitespace > changes. The policy wants only those parts you are going to change to be re-formatted, up to complete files (I've seen those sometimes), not entire components. > I also think given we also encourage people to clang-format out code, its > ironic clang-format itself is not clang-formatted! This should be pointed-out in reviews. Unfortunately, things will always slip through. Also, clang-format changes over time, i.e. we would have to reformat regularly anyway. Michael _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits