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

Re: [RFC 1/1] Add new indent-with-tab whitespace check

From
Chris Webb <chris@arachsys.com>
Date
Apr 2, 2010, 10:55 UTC
Message-ID
<20100402105504.GO19047@arachsys.com>
In-Reply-To
<7vsk7fovjx.fsf_-_@alter.siamese.dyndns.org>
Hi. Thanks for the detailed feedback.
Junio C Hamano <gitster@pobox.com> writes:
> This sounds more like "tab-in-indent".  Naming the option that way would
> give it an added benefit of allowing it to be abbreviated to "tab" by the
> parser.
Yes that's nice: much harder to confuse with indent-with-non-tab that way.
> I think WS_TAB_IN_INDENT are incompatible with either WS_SPACE_BEFORE_TAB
> or WS_INDENT_WITH_TAB.  Don't we want to notice such a combination as an
> error?

Oh yes, that has to be the right behaviour for the finished feature here. (I guess strictly they could coexist with the meaning 'no indented lines allowed at all' but I don't think that's useful or sensible.)

Show 9 quoted lines
> I'll queue this with s/indent-with-tab/tab-in-indent/ tweak to 'pu' but
> the topic would need:
> 
>  - detecting incompatible settings;
>  - tests;
>  - docs;
>  - matching change to apply --whitespace=fix;
> 
> before moving to 'next', I think.

Are you happy with my suggestion in [0/1] to replumb ws_fix_copy() to take a strbuf as dst rather than a char *, to deal with the fact that whitespace can grow with --whitespace=fix and WS_TAB_IN_INDENT?

If so, I'll polish up the existing patch as you suggest in your first three points above, and then make this change to the way ws_fix_copy() works so I can do the right thing in whitespace=fix.

Show 5 quoted lines
> There is another issue with this change.  Because "whitespace" without any
> string in .gitattributes are defined to cause all the whitespace breakages
> known to git to be caught, and tab-in-indent is inherently incompatible
> with indent-with-non-tab, this cannot be supported without changing the
> definition of "default set of whitespace breakage classes".

Ah, this was a behaviour I didn't know about. I should probably put your patch (without the WS_TAB_IN_INDENT line) as the first one in the series, before I introduce WS_TAB_IN_INDENT, so we don't break this wildcard whitespace behaviour at any point in the series.

Cheers,
Chris.
Previous: Junio C Hamano
Message 6 of 6 in “[RFC 0/1] diff --check for indent-with-spaces style”
  1. Chris WebbMar 27, 2010
  2. 1/1 Add new indent-with-tab whitespace checkChris Webb, Mar 27, 2010
  3. Junio C HamanoMar 31, 2010
  4. Re* [RFC 1/1] Add new indent-with-tab whitespace checkJunio C Hamano, Apr 1, 2010
  5. Junio C HamanoApr 1, 2010
  6. Chris WebbApr 2, 2010

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.