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

Re: [PATCH v2] ws: add new tab-between-non-ws check

From
Adrian Ratiu <adrian.ratiu@collabora.com>
Date
Jan 9, 2026, 13:33 UTC
Message-ID
<87h5sux64k.fsf@collabora.com>
In-Reply-To
<dcd87fc4-6514-4146-9e44-1276bd739d2f@kdbg.org>
On Thu, 08 Jan 2026, Johannes Sixt <j6t@kdbg.org> wrote:
Show 32 quoted lines
> Am 07.01.26 um 18:33 schrieb Johannes Sixt:
>> Am 07.01.26 um 02:30 schrieb Adrian Ratiu:
>>> The check is a bit complex because we want to detect places where
>>> a SP was intended (HT can expand to more than one display column),
>>> so we need to count both the display columns (col) and the string
>>> character columns (i) to determine if a HT looks identical to a SP
>>> or can cause confusion.
>>>
>>> Highlighting support for tools like git diff/show/log is added, as
>>> well as git apply --whitespace=fix capability.
>>>
>>> The middle section of the line used to be assumed non-highlighted,
>>> which is obviously not true anymore, so we split its logic into a
>>> separate function named emit_middle_section().
>>>
>>> The new check is enabled for Documentation/**/*.adoc, where these
>>> kinds of mistakes were seen in practice. It can also be enabled in
>>> other locations where it can be useful, by adding to the relevant
>>> attributes file.
>
> This makes me wonder how useful this check is. Yes, I has happened that
> I didn't spot at TAB that should have been a SP, but perhaps a handful
> of times in my career. Compare this to the many times that the other
> kinds of whitespace errors happened.
>
> Applying the rule to all documentation files is questionable: I can't
> format a table with TAB characters between columns reliably, because if
> a column happens to be 7 characters wide, the TAB at the 8th position
> would be diagnosed, but I certainly do *not* want it to be replaced by a
> SP. Yet, I might want legitimate cases outside tables to be diagnosed, so...
>
> Maybe I'm too much of a devil's advocate here...

I'll let Junio decide on the usefulness of this check since he's the one who asked for it. :)

Maybe we could improve the heuristic to detect tables, for example patterns like a\tb\tc.

I'm ok either way, just let me know if I should pursue this further.
Previous: Johannes Sixt
Message 8 of 8 in “ws: add new tab-between-non-ws check”
  1. ws: add new tab-between-non-ws checkAdrian Ratiu, Jan 7, 2026
  2. Junio C HamanoJan 7, 2026
  3. Adrian RatiuJan 7, 2026
  4. Johannes SixtJan 7, 2026
  5. Adrian RatiuJan 7, 2026
  6. Johannes SixtJan 8, 2026
  7. Johannes SixtJan 8, 2026
  8. Adrian RatiuJan 9, 2026

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.