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

Re: builtin conversion between tabs and spaces

From
Stefan Karpinski <stefan.karpinski@gmail.com>
Date
Oct 15, 2008, 23:02 UTC
Message-ID
<d4bc1a2a0810151602j56550c3di2f59f92039fa8243@mail.gmail.com>
In-Reply-To
<d4bc1a2a0810151418r3bf21ddaj498017e8e178f579@mail.gmail.com>

Any further comments? I'm more than willing to implement this, but I won't bother if there's no chance of getting it accepted as a patch. Does no one else feel like at least having the option to enforce whitespace consistency in git is a good thing? If not, I guess I'll just muddle along without this feature instead of implementing it.

On Wed, Oct 15, 2008 at 2:18 PM, Stefan Karpinski <stefan.karpinski@gmail.com> wrote:

Show 27 quoted lines
> That's not what I would call a "crazy" mix of tabs and spaces, but
> rather a *sane* mix of tabs and spaces. That can consistently be
> reproduced, and is in fact what the spaces_to_tabs function included
> above produces. The sane consistent formats as I see it are:
>
>  1) use spaces for everything
>  2) use tabs for indentation, spaces for everything else
>  3) use tabs for indentation and alignment
>
> If you know the tab size, you can reproduce any of these from the
> others, except that #3 is a little tricky since there's places where
> the tab/space issue can be ambiguous. I actually think that keeping
> the repo version with tab-based indentation is a very sane thing to
> do. However, I'd still like to be able to edit the files using soft
> tabs, largely because any program that doesn't know what my tab size
> should be applies its own interpretation and makes the code look
> terrible (think terminal output for diff, cat, less, etc.)
>
> On the other hand, a *crazy* mix of tabs and spaces is where some
> indentation is done with spaces while other indentation is done with
> tabs. Even crazier is a single line where the indentation is a mixture
> of tabs and spaces. I think that just about everyone can agree that
> this is not only crazy, but evil and is the kind of thing one really
> wants to avoid in a code base. Unfortunately, when developers disagree
> on their standard settings, it's very, very hard to avoid precisely
> this kind of mess. My idea is to enable git to prevent this sort of
> insanity if configured to do so.
Previous: Stefan KarpinskiNext: A Large Angry SCM
Message 7 of 11 in “builtin conversion between tabs and spaces”
  1. Stefan KarpinskiOct 15, 2008
  2. Stefan KarpinskiOct 15, 2008
  3. Alex RiesenOct 15, 2008
  4. Stefan KarpinskiOct 15, 2008
  5. Jonathan del StrotherOct 15, 2008
  6. Stefan KarpinskiOct 15, 2008
  7. Stefan KarpinskiOct 15, 2008
  8. A Large Angry SCMOct 15, 2008
  9. Stefan KarpinskiOct 16, 2008
  10. Johannes SixtOct 15, 2008
  11. Stefan KarpinskiOct 15, 2008

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.