From: Jonathan Nieder <jrnieder@gmail.com>
To: Christoph Mallon <christoph.mallon@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: git diff --check always shows line 1 for blank at EOF for new files
Date: Thu, 7 Oct 2010 04:32:58 -0500 [thread overview]
Message-ID: <20101007093258.GA10941@burratino> (raw)
In-Reply-To: <4CAC411E.3010204@gmx.de>
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.
next prev parent reply other threads:[~2010-10-07 9:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 9:27 git diff --check always shows line 1 for blank at EOF for new files Christoph Mallon
2010-10-07 9:32 ` Jonathan Nieder [this message]
2010-10-07 12:33 ` Christoph Mallon
2010-10-10 10:46 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101007093258.GA10941@burratino \
--to=jrnieder@gmail.com \
--cc=christoph.mallon@gmx.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).