On Wed, Aug 09 2017, Jeff King jotted:
> On Mon, Aug 07, 2017 at 06:25:54PM -0700, Brandon Williams wrote:
>> I'm sure this sort of thing comes up every so often on the list but back at
>> git-merge I mentioned how it would be nice to not have to worry about style
>> when reviewing patches as that is something mechanical and best left to a
>> machine (for the most part). I saw that 'clang-format' was brought up on the
>> list once before a couple years ago
>> (https://public-inbox.org/git/20150121220903.ga10...@peff.net/) but nothing
>> really came of it. I spent a little bit of time combing through the various
>> options and came up with this config based on the general style of our code
>> base. The big issue though is that our code base isn't consistent so try as
>> you might you wont be able to come up with a config which matches everything
>> do (mostly due to the inconsistencies in our code base).
> Right, the reason I stopped pursuing it was that I couldn't find a way
> to have it make suggestions for new code without nagging about existing
> code. If we were to aggressively reformat to match the tool for existing
> code, that would help. But I'm a bit worried that there would always be
> suggestions from the tool that we don't agree with (i.e., where the
> guiding principle is "do what is readable").
> I dunno. I guess "go fmt" people decided to just treat the tool's output
> as the One True Way. I haven't written enough Go to have an opinion
> myself, but it seems to at least work for them.
(I have no opinion either way on whether this clang formatting this is a
good idea or not)
> What does the tooling look like these days for just adjusting lines
> touched by a given patch?
Presumably even if it sucked we could easily write a "./git-fmt-check.sh
<file>" script to do it which would do the following:
1. Check out the master branch
2. Apply code formatting to entire project (or just the files you
3. Commit that on a throwaway branch
4. Switch back to your WIP branch
5. See if it would merge cleanly with the throwaway code formatting
branch (I forget the actual 'not a real merge but check' command to
do this, but it exists).
If there were any reported conflicts presumably the new code you're
adding is violating the coding standards laid out in this file. If not