From: Vishvajit Singh <vishvajitsingh@gmail.com>
To: git@vger.kernel.org
Subject: git diff --numstat notices empty file creation, while --stat does not
Date: Fri, 23 Apr 2010 00:17:13 -0400 [thread overview]
Message-ID: <k2r520868e81004222117nedbd7a3flb94bf7bef65d9c68@mail.gmail.com> (raw)
I noticed that, in the case of two trees that differ in the creation
or deletion of an empty file, git diff --numstat provides information
about the empty file, whereas git diff --stat does not.
$ git --version
git version 1.6.1.2
$ git status
# On branch master
nothing to commit (working directory clean)
$ touch x.txt
$ git add x.txt
$ git commit -m 'add x.txt'
[master]: created 62f3c25: "add x.txt"
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 x.txt
$ git diff --stat HEAD^ HEAD
0 files changed, 0 insertions(+), 0 deletions(-)
$ git diff --numstat HEAD^ HEAD
0 0 x.txt
This behaviour surprised me as I had been using diff --stat to get an
overview of the current differences between my working branch and the
master, and I had created a temporary to-do-list file in that branch
which I had subsequently emptied. In closing that branch, I might have
inadvertently merged the empty file into the master if I had not
remembered it was there. (I will use --numstat instead now.)
Is this small difference in behaviour between the two intentional?
Thanks,
Vishvajit Singh
reply other threads:[~2010-04-23 4:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=k2r520868e81004222117nedbd7a3flb94bf7bef65d9c68@mail.gmail.com \
--to=vishvajitsingh@gmail.com \
--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.
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 NNTP newsgroup(s).