{"thread":{"id":"23575","subject":"git diff --numstat notices empty file creation, while --stat does not","startedAt":"2010-04-23T04:17:13Z","lastAt":"2010-04-23T04:17:13Z","messageCount":1,"participants":["Vishvajit Singh"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"140185","messageId":"k2r520868e81004222117nedbd7a3flb94bf7bef65d9c68@mail.gmail.com","threadId":"23575","inReplyTo":null,"subject":"git diff --numstat notices empty file creation, while --stat does not","fromName":"Vishvajit Singh","fromEmail":"vishvajitsingh@gmail.com","sentAt":"2010-04-23T04:17:13Z","receivedAt":"2010-04-23T04:17:13Z","isPatch":false,"sender":{"key":"vishvajitsingh@gmail.com","avatar":null},"body":"I noticed that, in the case of two trees that differ in the creation\nor deletion of an empty file, git diff --numstat provides information\nabout the empty file, whereas git diff --stat does not.\n\n$ git --version\ngit version 1.6.1.2\n$ git status\n# On branch master\nnothing to commit (working directory clean)\n$ touch x.txt\n$ git add x.txt\n$ git commit -m 'add x.txt'\n[master]: created 62f3c25: \"add x.txt\"\n 0 files changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 x.txt\n$ git diff --stat HEAD^ HEAD\n 0 files changed, 0 insertions(+), 0 deletions(-)\n$ git diff --numstat HEAD^ HEAD\n0       0       x.txt\n\nThis behaviour surprised me as I had been using diff --stat to get an\noverview of the current differences between my working branch and the\nmaster, and I had created a temporary to-do-list file in that branch\nwhich I had subsequently emptied. In closing that branch, I might have\ninadvertently merged the empty file into the master if I had not\nremembered it was there. (I will use --numstat instead now.)\n\nIs this small difference in behaviour between the two intentional?\n\nThanks,\nVishvajit Singh\n"}]}