git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: .clang-format: how useful, how often used, and how well maintained?

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 22, 2025, 04:11 UTC
Message-ID
<xmqqfrfs8lga.fsf@gitster.g>
In-Reply-To
<20250621050743.GA3007684@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> My ideal workflow would probably be taking a pass with:
>
>   git rebase -x 'git clang-format --style=file -p HEAD^ || git commit --no-edit --amend -a'
>
> is a better match.  That command is a bit of a mouthful, but we
> could perhaps roll it into a script or a Makefile target.

The "-p" option does sound like a good thing. Taking the tool's suggestion wholesale without human judgement would be better than taking what a human developer typed as-is only for somebody totally new to the language and to the project. For more experienced developers, I would trust human judgement a lot more than I trust the tool's suggestion, and "-p" may be a good escape hatch.

> The current "make
> style" only looks at uncommitted changes in the working tree (and of
> course isn't interactive).
Yes, that makes it much less useful than it could be.
> The big pain I see in this (or any other workflow) is getting bugged
> about suggestions you've rejected. In an ideal world we'd tune
> .clang-format so that all of its suggestions are good, but I don't think
> we're there yet. ;)
Me neither.
Previous: Jeff KingNext: brian m. carlson
Message 7 of 18 in “.clang-format: how useful, how often used, and how well maintained?”
  1. Junio C HamanoJun 19, 2025
  2. Christian CouderJun 19, 2025
  3. Junio C HamanoJun 20, 2025
  4. Christian CouderJun 20, 2025
  5. Junio C HamanoJun 20, 2025
  6. Jeff KingJun 21, 2025
  7. Junio C HamanoJun 22, 2025
  8. brian m. carlsonJun 19, 2025
  9. Collin FunkJun 19, 2025
  10. brian m. carlsonJun 19, 2025
  11. Junio C HamanoJun 20, 2025
  12. Toon ClaesJul 1, 2025
  13. Johannes SchindelinJul 1, 2025
  14. Junio C HamanoJul 1, 2025
  15. Junio C HamanoJul 1, 2025
  16. Karthik NayakJun 23, 2025
  17. Junio C HamanoJun 23, 2025
  18. Karthik NayakJun 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.