diff --numstat: show binary with '-' to match "apply --numstat"
authorJunio C Hamano <junkio@cox.net>
Sun, 10 Dec 2006 21:50:59 +0000 (13:50 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 11 Dec 2006 22:17:19 +0000 (14:17 -0800)
This changes the --numstat output for binary files from "0 0" to
"- -" to match what "apply --numstat" does.

Signed-off-by: Junio C Hamano <junkio@cox.net>
diff.c

diff --git a/diff.c b/diff.c
index 33153787b8117396cf906e69e656849ac04f3257..d6d17f47346a6af88bc25cbebfa029d445b8f672 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -802,7 +802,10 @@ static void show_numstat(struct diffstat_t* data, struct diff_options *options)
        for (i = 0; i < data->nr; i++) {
                struct diffstat_file *file = data->files[i];
 
-               printf("%d\t%d\t", file->added, file->deleted);
+               if (file->is_binary)
+                       printf("-\t-\t");
+               else
+                       printf("%d\t%d\t", file->added, file->deleted);
                if (options->line_termination &&
                    quote_c_style(file->name, NULL, NULL, 0))
                        quote_c_style(file->name, NULL, stdout, 0);