We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1fd8f97 + de9658b commit 0b6e913Copy full SHA for 0b6e913
2 files changed
diff.c
@@ -1700,7 +1700,7 @@ static void show_shortstats(struct diffstat_t *data, struct diff_options *option
1700
continue;
1701
if (!data->files[i]->is_renamed && (added + deleted == 0)) {
1702
total_files--;
1703
- } else {
+ } else if (!data->files[i]->is_binary) { /* don't count bytes */
1704
adds += added;
1705
dels += deleted;
1706
}
t/t4012-diff-binary.sh
@@ -36,6 +36,18 @@ test_expect_success '"apply --stat" output for binary file change' '
36
test_i18ncmp expected current
37
'
38
39
+test_expect_success 'diff --shortstat output for binary file change' '
40
+ echo " 4 files changed, 2 insertions(+), 2 deletions(-)" >expected &&
41
+ git diff --shortstat >current &&
42
+ test_i18ncmp expected current
43
+'
44
+
45
+test_expect_success 'diff --shortstat output for binary file change only' '
46
+ echo " 1 file changed, 0 insertions(+), 0 deletions(-)" >expected &&
47
+ git diff --shortstat -- b >current &&
48
49
50
51
test_expect_success 'apply --numstat notices binary file change' '
52
git diff >diff &&
53
git apply --numstat <diff >current &&
0 commit comments