Merge branch 'zj/diff-empty-chmod'
authorJunio C Hamano <gitster@pobox.com>
Mon, 7 May 2012 20:29:08 +0000 (13:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 May 2012 20:29:08 +0000 (13:29 -0700)
"git diff --stat" used to fully count a binary file with modified
execution bits whose contents is unmodified, which was not right.

By Zbigniew Jędrzejewski-Szmek (4) and Johannes Sixt (1)
* zj/diff-empty-chmod:
  t4006: Windows do not have /dev/zero
  diff --stat: do not run diff on indentical files
  diff --stat: report mode-only changes for binary files like text files
  tests: check --[short]stat output after chmod
  test: modernize style of t4006

Conflicts:
diff.c

1  2 
diff.c

diff --cc diff.c
index 02081d2af249d7fef660bd401a6d508b2e21cff1,8e61f4bf857eb80ec067336604fba2382eb4219c..77edd5086fff30af36e92a151377c285de21aca3
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -1614,8 -1583,12 +1614,12 @@@ static void show_stats(struct diffstat_
                if (data->files[i]->is_binary) {
                        fprintf(options->file, "%s", line_prefix);
                        show_name(options->file, prefix, name, len);
-                       fprintf(options->file, " %*s ", number_width, "Bin");
-                       fprintf(options->file, "%s%"PRIuMAX"%s",
 -                      fprintf(options->file, "  Bin");
++                      fprintf(options->file, " %*s", number_width, "Bin");
+                       if (!added && !deleted) {
+                               putc('\n', options->file);
+                               continue;
+                       }
+                       fprintf(options->file, " %s%"PRIuMAX"%s",
                                del_c, deleted, reset);
                        fprintf(options->file, " -> ");
                        fprintf(options->file, "%s%"PRIuMAX"%s",