Subject: Re: [PATCH v2 00/12] Incomplete lines

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 10 Nov 2025 11:09:50 +0100

On Wed, Nov 05, 2025 at 01:30:40PM -0800, Junio C Hamano wrote:
> One of the common kind of whitespace errors is to lack the final
> newline at the end of a file, but so far, neither "git diff" or "git
> apply" did anything about them.
> 
> This series introduces "incomplete-line" whitespace error class,
> that you can add to either the core.whitespace configuration
> variable, or the whitespace attribute in your .gitattributes files.
> 
> The class is disabled by default, so the final step enables it for
> our project by defining it in the .gitattributes file.
> 
> The incomplete line marker that is given for a context line is not
> considered an error.  The reasoning is that your preimage did have
> incomplete line, but you did not touch the contents on that
> incomplete line in your patch, so you left the line intact.  It is
> not a new breakage you are responsible for.
> 
> If the incomplete line marker follows a postimage line, on the other
> hand, it means that you added a new line at the end of the file that
> is incomplete *and* that line did not exist in the preimage.  The
> last line of the preimage may have been incomplete already, but then
> you updated the contents on that line, so you could have easily
> fixed the incompleteness of the line while at it.  Either way, you
> are responsible for the incompleteness of the last ine in the
> resulting file.

I've read through the series and left two comments, but my review
definitely doesn't count as a "qualified" review. I'm way too oblivious
of what's happening in the diff subsystem to really be able to point out
any mistakes. So I hope that somebody more familiar with this code will
chime in.

That being said, I think that the end goal of this series is quite
useful and something that I want to have :)

Thanks!

Patrick