Re: [PATCH v2] ws: add new tab-between-non-ws check
- From
Adrian Ratiu <adrian.ratiu@collabora.com>
- Date
- Jan 7, 2026, 11:34 UTC
- Message-ID
- <87a4ypirks.fsf@gentoo.mail-host-address-is-not-set>
- In-Reply-To
- <xmqqsecii327.fsf@gitster.g>
On Wed, 07 Jan 2026, Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
> Adrian Ratiu <adrian.ratiu@collabora.com> writes: > >> 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.
I like "tab-instead-of-space". :)
Will wait some time in case others have suggestions and if we can't come up with something better, then I will use "tab-instead-of-space" in v3.
Show 15 quoted lines
>> +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.
That is a good idea. Will fix in v3. Thanks!