Re: Git trailing blank lines feature configuration

Junio C Hamano <[email protected]> Fri, 31 Jul 2026 11:49:25 -0700
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
Johannes Sixt <[email protected]> writes:

> Am 31.07.26 um 12:19 schrieb Thomas Nemeth:
>>     I have the habit to keep 1 blank line at the end of my files. To me,
>>     it eases the EOF modifications (selecting code blocks, pasting them)
>>     in vim.
>
> (Call this is [x].)
>
>>     Would it be possible to have a configuration option to avoid warnings
>>     (because I see that as a warning) about trailing blank lines ?
> Hearing the first time that an extra blank line at EOF is necessary or
> useful. Would the correct question then perhaps be: how do you all
> handle [x] without an extra blank line at EOF?
>
> That said, are you looking to disable blank-at-eof from core.whitespace?
> Collect all "enabled by default" except this one from [*].
>
> [*]
> https://git-scm.com/docs/git-config#Documentation/git-config.txt-corewhitespace
>
> -- Hannes

Ah, if "I want a configuration that does not complain when it sees
any number (including zero) of blank lines" is what is asked for,
then yes, 'blank-at-eof' would be sufficient.  

I misread the request as "I want it to complain if there is not
exactly one blank line at the end" (i.e., zero blank lines will be
flagged as not vi-friendly and two or more blank lines will be
flagged as excess blank lines at the end).  That is not something
'blank-at-eof' would help you achieve.