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
Junio C Hamano <gitster@pobox.com>
Date
Jan 7, 2026, 02:12 UTC
Message-ID
<xmqqsecii327.fsf@gitster.g>
In-Reply-To
<20260107013051.312291-1-adrian.ratiu@collabora.com>
Adrian Ratiu <adrian.ratiu@collabora.com> writes:
Show 7 quoted lines
> 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.
>
> +/....adoc text eol=lf whitespace=trail,space,incomplete,tab-between-non-ws

The name of the whitespace rule does not quite match what we want to catch. Can somebody find a phrasing than "between non-ws" that conveys our intent better? We want to catch a tab that is used by mistsake when the writer would have used a space, and "between non-ws" is one of the heuristics (another is "it is at the 7th column to make it indistinguishable from a space") the code uses to tell if a tab is such a mistaken tab. "tab-instead-of-space"? "tab-in-place-of-space"? "tab-that-should-have-been-a-space"?

The last one is horrible and not a serious suggestion, of course.
> +test_expect_success 'check tab between non-whitespace (tab-between-non-ws: off)' '
> +	git config core.whitespace "-tab-between-non-ws" &&
> +
> +	printf "1234567\tb" >x &&

I notice all these printf create incomplete lines. It is true that the detection of a tab that is used when it should have been a space should work even on an incomplete line, but using an incomplete line, which is of course rather unusual, for these tests gives a false impression that somehow this requires an incomplete line to trigger, which is not what we want to give.

	printf "1234567\tb\n" > x &&
or something, perhaps?  I dunno.
Previous: Adrian RatiuNext: Adrian Ratiu
Message 2 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.