Re: git diff --check always shows line 1 for blank at EOF for new files

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

 



Hi Christoph,

Christoph Mallon wrote:

>   git init test
>   cd test
>   printf 'a\nb\nc\n\n' > file
>   git add -AN
>   git diff --check
> 
> The last command will show "file:1: new blank line at EOF.".
> 
> It works fine, if the diff is not against /dev/null, e.g.:
>   git init test
>   cd test
>   printf 'a\nb\nc\n' > file
>   git add -A
>   echo >> file
>   git diff --check
> 
> This correctly shows "file:4: new blank line at EOF.".

Try this:

    git init test
    cd test
    printf 'a\nb\nc\n' > file
    git add -A
    echo hello >> file
    echo >> file
    git diff --check

As you can see, it still returns line 4, which is the beginning of the
hunk that adds the blank line.

A change to make it print the line number of the blank line itself
does not sound so bad, though.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]