Git development
 help / color / mirror / Atom feed
* Git trailing blank lines feature configuration
@ 2026-07-31 10:19 Thomas Nemeth
  2026-07-31 11:08 ` Johannes Sixt
  2026-07-31 15:50 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Nemeth @ 2026-07-31 10:19 UTC (permalink / raw)
  To: git

    Hi !

    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.

    Note that I still want to remove blanks at EOL. But I'd like to keep
    1 blank trailing line. I still can, of course, but the diff still
    shows me a red "+"...

    Would it be possible to have a configuration option to avoid warnings
    (because I see that as a warning) about trailing blank lines ?

    Thanks

Thomas.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git trailing blank lines feature configuration
  2026-07-31 10:19 Git trailing blank lines feature configuration Thomas Nemeth
@ 2026-07-31 11:08 ` Johannes Sixt
  2026-07-31 11:50   ` Thomas Nemeth
  2026-07-31 18:49   ` Junio C Hamano
  2026-07-31 15:50 ` Junio C Hamano
  1 sibling, 2 replies; 5+ messages in thread
From: Johannes Sixt @ 2026-07-31 11:08 UTC (permalink / raw)
  To: Thomas Nemeth; +Cc: git

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git trailing blank lines feature configuration
  2026-07-31 11:08 ` Johannes Sixt
@ 2026-07-31 11:50   ` Thomas Nemeth
  2026-07-31 18:49   ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Nemeth @ 2026-07-31 11:50 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

Le vendredi 31 juillet 2026, 13:08 Johannes Sixt a écrit :
> 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

    I wouldn't say necessary, of course. It's -- at least -- my
    preference. For _my_ use case, it's useful. When I move code
    around, and that code is at the end of the file or to be put
    at the end of the file, I find it easier to already have a
    blank line there. That is... Because that's how I use vim to
    code.


> 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-corewhi
> tespace

    -_-;
    indeed.

    ```
    git config --global core.whitespace "-blank-at-eof"
    ```

-- 
Thomas.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git trailing blank lines feature configuration
  2026-07-31 10:19 Git trailing blank lines feature configuration Thomas Nemeth
  2026-07-31 11:08 ` Johannes Sixt
@ 2026-07-31 15:50 ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2026-07-31 15:50 UTC (permalink / raw)
  To: Thomas Nemeth; +Cc: git

Thomas Nemeth <tnemeth@free.fr> writes:

>     Hi !
>
>     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.
>
>     Note that I still want to remove blanks at EOL. But I'd like to keep
>     1 blank trailing line. I still can, of course, but the diff still
>     shows me a red "+"...
>
>     Would it be possible to have a configuration option to avoid warnings
>     (because I see that as a warning) about trailing blank lines ?
>
>     Thanks
>
> Thomas.

Would it be possible with the current system?  No.

Would it be possible to add such a new feature?  If designed well,
perhaps.

Things to consider (though not exhaustive) include:

 - What mechanism should this modify?

 - What should the new option be called?

 - Do we only need to accommodate those who want one trailing blank
   line?  What about those who want two?  Three?

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git trailing blank lines feature configuration
  2026-07-31 11:08 ` Johannes Sixt
  2026-07-31 11:50   ` Thomas Nemeth
@ 2026-07-31 18:49   ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2026-07-31 18:49 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Thomas Nemeth, git

Johannes Sixt <j6t@kdbg.org> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-31 18:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 10:19 Git trailing blank lines feature configuration Thomas Nemeth
2026-07-31 11:08 ` Johannes Sixt
2026-07-31 11:50   ` Thomas Nemeth
2026-07-31 18:49   ` Junio C Hamano
2026-07-31 15:50 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox