Re: git diff shows twice “\ No newline at end of file” - no need for repetition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Phillip Wood <phillip.wood123@xxxxxxxxx> writes:

> On 13/08/2025 08:20, Дилян Палаузов wrote:
>> Hello,
>> when a file, which does not end in a new line, is modified, git diff
>> shows twice the text “\ No newline at end of file”. As this piece
>> of the file is not modified, I think git diff should print it once.
>> In the example below the first “\ No newline at end of file”
>> should be skipped.
>
> The "\ No newline at end of file" applies to the line that precedes
> it. Removing the first instance in your example would mean the the
> newline at the end of the file had been removed when the line was
> changed. The output of git matches what GNU diff shows for incomplete
> lines.
>
> Thanks

Thanks for a concise and accurate diagnosis.  It is unfortunate that
we cannot point at POSIX X-<.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux