Re: "git diff --stat" doesn't show added empty file

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

 



Hi,

On Mon, 12 Jan 2009, Michael J Gruber wrote:

> Johannes Schindelin venit, vidit, dixit 01/12/09 13:19:
> 
> > On Mon, 12 Jan 2009, Ping Yin wrote:
> > 
> >> $ git --version
> >> git version 1.6.1.9.g97c34
> >> $ mkdir test && cd test && git init && git commit --allow-empty -m
> >> "Initial commit"
> >> $ touch .gitignore && git add .gitignore && git commit -m "Add empty .gitignore"
> >> $ git diff --stat HEAD^..
> >>  0 files changed, 0 insertions(+), 0 deletions(-)
> >>
> >> May be the following is better?
> >>
> >>  .gitignore |    0 +
> >>  1 files changed, 0 insertions(+), 0 deletions(-)
> > 
> > Have fun coding that.
> 
> Removing 5 lines from diff.c does the job,

I can only think that you mean these lines:

                else if (!data->files[i]->is_renamed &&
                         (added + deleted == 0)) {
                        total_files--;
                        continue;
                }

However, they are also present in the initial stat code in d75f7952:

                } else if (added + deleted == 0) {
                        total_files--;
                        continue;
                }

Now, the fun part is finding out why this code is there.  Are there 
unintended side effects?  If so, are they still there?  Or was it 
introduced due to an explicit request back then?  Was it just sloppy?

Removing the 5 lines is not all you have to do, by _far_.

Lots of fun,
Dscho


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

  Powered by Linux