diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-02-24 17:37:15 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-24 17:39:10 -0800 |
commit | 2b0b551d7662a4246ed55b6a7029ba3caa65cf98 (patch) | |
tree | 4a51743ee9abdc109322ede8fde9a8ae2e3bc064 | |
parent | 7df7c019c2a46672c12a11a45600cdc698e03029 (diff) | |
download | git-2b0b551d7662a4246ed55b6a7029ba3caa65cf98.tar.gz git-2b0b551d7662a4246ed55b6a7029ba3caa65cf98.tar.xz |
diff --dirstat: saner handling of binary and unmerged files
We do not account binary nor unmerged files when --shortstat is
asked for (or the summary stat at the end of --stat).
The new option --dirstat should work the same way as it is about
summarizing the changes of multiple files by adding them up.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | diff.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1016,7 +1016,10 @@ static long gather_dirstat(struct diffstat_dir *dir, unsigned long changed, cons this = gather_dirstat(dir, changed, f->name, newbaselen); sources++; } else { - this = f->added + f->deleted; + if (f->is_unmerged || f->is_binary) + this = 0; + else + this = f->added + f->deleted; dir->files++; dir->nr--; sources += 2; @@ -1053,6 +1056,8 @@ static void show_dirstat(struct diffstat_t *data, struct diff_options *options) /* Calculate total changes */ changed = 0; for (i = 0; i < data->nr; i++) { + if (data->files[i]->is_binary || data->files[i]->is_unmerged) + continue; changed += data->files[i]->added; changed += data->files[i]->deleted; } |