Re: [PATCH v2 0/2] clang-format
- From
Jeff King <peff@peff.net>
- Date
- Aug 14, 2017, 23:06 UTC
- Message-ID
- <20170814230657.bmn7exoqmqw3tlyh@sigill.intra.peff.net>
- In-Reply-To
- <20170814213046.107576-1-bmwill@google.com>
On Mon, Aug 14, 2017 at 02:30:44PM -0700, Brandon Williams wrote:
Show 11 quoted lines
> Changes in v2: > * Changed a couple rules to be more inline with our coding style. > * Added a Makefile build rule to run git-clang-format on the diff of the > working tree to suggest style changes. > > I found that the llvm project also has the git-clang-format tool which will > allow for doing formating changes based on diffs so that the parts of the code > you didn't touch won't be formated. It also has a nice '-p' option to only > apply hunks of suggested changes. I also saw what Ramsay did and attempted to > add a Makefile rule to run clang-format. This bit may need more tweaking to > get it right.
One more oddity I found while playing with this that Git folks might run into:
$ git init tmp && cd tmp
$ git commit --allow-empty -m foo
$ echo "[mysection]mykey" >>.git/config
$ git clang-format-5.0
Traceback (most recent call last):
File "/usr/bin/git-clang-format-5.0", line 579, in <module>
main()
File "/usr/bin/git-clang-format-5.0", line 62, in main
config = load_git_config()
File "/usr/bin/git-clang-format-5.0", line 194, in load_git_config
name, value = entry.split('\n', 1)
ValueError: need more than 1 value to unpack$ sed -i 's/mykey/&=true/' .git/config $ git clang-format-5.0 no modified files to format
So it looks like they do their own config parsing and it's not quite compatible. :(
That's not the end of the world, and something we can try to fix upstream. I just wanted to mention it here so other people don't waste time trying to track down the problem.
-Peff