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

RE: Tabs in commit messages - de-tabify option in strbuf_stripspace()?

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Mar 16, 2016, 00:34 UTC
Message-ID
<009801d17f1b$a4c3e080$ee4ba180$@nexbridge.com>
In-Reply-To
<CA+55aFzHMp4hiCp7+2Yxy=KNQ_rBru3RM-pghXUPtoxr_L+w2w@mail.gmail.com>
On March 15, 2016 8:17 PM Linus Torvalds wrote:
Show 17 quoted lines
> So I end up doing this manually when I notice, but I was wondering ig maybe
> git could just have an option to "git am" and friends to de-tabify the commit
> message.
> 
> It's particularly noticeable when people line things up using tabs (for the
> kernel, it's often things like "cpu1 does X, cpu2 does Y"), and then when you
> do "git log" it looks like a unholy mess, because the 4-char indentation of the
> log message ends up causing those things to not line up at all after all.
> 
> The natural thing to do would be to pass in a "tab size" parameter to
> strbuf_stripspace(), and default it to 0 (for no change), but have some way to
> let people say "expand tabs to spaces at 8-character tab-stops" or similar
> (but let people use different tab-stops if they want).
> 
> Do people hate that idea? I may not get around to it for a while (it's the
> kernel merge window right now), but I can write the patch eventually - I just
> wanted to do an RFC first.
Speaking partly as a consumer of the comments and partly as someone who generates the commits through APIs, I would ask that the commit tab handling semantic be more formalized than just tab size to strbuf_stripspace(). While it might seem a bit unfair to have to worry about non-git git clients, the detabbing can impact the other commit implementers (e.g., SourceTree, EGit, JGit, and the raft of process automation bits out there using JGit for cool stuff). Personally, I would prefer to have a normalized behaviour so that any bit of automation building a commit message would have a specific definition to go to (and hopefully comply with) in order to properly format the message for posterity and across all consumers. It might also be useful to have some ability to be presentation-compatible 
 with legacy commits (done after this type of enhancement) so that a reasonable presentation can be done for those 8 year old commits that still have embedded tabs. Personally, I don't encourage tabs in commits myself and do see the value of this, but is this really restricted just to git am?
Just my $0.02,
Randall

-- Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400)/NonStop(211288444200000000) -- In my real life, I talk too much.

Previous: Linus TorvaldsNext: Junio C Hamano
Message 4 of 17 in “Tabs in commit messages - de-tabify option in strbuf_stripspace()?”
  1. Linus TorvaldsMar 16, 2016
  2. Stefan BellerMar 16, 2016
  3. Linus TorvaldsMar 16, 2016
  4. Randall S. BeckerMar 16, 2016
  5. Junio C HamanoMar 16, 2016
  6. Linus TorvaldsMar 16, 2016
  7. Stefan BellerMar 16, 2016
  8. Stefan BellerMar 16, 2016
  9. Marc BranchaudMar 16, 2016
  10. Duy NguyenMar 16, 2016
  11. Linus TorvaldsMar 16, 2016
  12. Junio C HamanoMar 16, 2016
  13. Matthieu MoyMar 20, 2016
  14. Linus TorvaldsMar 16, 2016
  15. Junio C HamanoMar 16, 2016
  16. Linus TorvaldsMar 16, 2016
  17. Jeff KingMar 16, 2016

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.