{"thread":{"id":"30823","subject":"[PATCH v3 1/2] diff: Only count lines in show_shortstats","startedAt":"2012-06-15T21:50:30Z","lastAt":"2012-06-15T22:00:39Z","messageCount":3,"participants":["Alexander Strasser","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"193743","messageId":"eae8caaf80d3bc90051de3f8f022bda01016bfd8.1339796363.git.eclipse7@gmx.net","threadId":"30823","inReplyTo":null,"subject":"[PATCH v3 1/2] diff: Only count lines in show_shortstats","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-06-15T21:50:30Z","receivedAt":"2012-06-15T21:50:30Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Do not mix byte and line counts. Binary files have byte counts;\nskip them when accumulating line insertions/deletions.\n\nThe regression was introduced in e18872b.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\n---\n diff.c                 | 2 +-\n t/t4012-diff-binary.sh | 6 ++++++\n 2 files changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/diff.c b/diff.c\nindex 77edd50..1a594df 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1700,7 +1700,7 @@ static void show_shortstats(struct diffstat_t *data, struct diff_options *option\n \t\t\tcontinue;\n \t\tif (!data->files[i]->is_renamed && (added + deleted == 0)) {\n \t\t\ttotal_files--;\n-\t\t} else {\n+\t\t} else if (!data->files[i]->is_binary) { /* don't count bytes */\n \t\t\tadds += added;\n \t\t\tdels += deleted;\n \t\t}\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 8b4e80d..7d03c1d 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -36,6 +36,12 @@ test_expect_success '\"apply --stat\" output for binary file change' '\n \ttest_i18ncmp expected current\n '\n \n+test_expect_success 'diff --shortstat output for binary file change' '\n+\techo \" 4 files changed, 2 insertions(+), 2 deletions(-)\" >expected &&\n+\tgit diff --shortstat >current &&\n+\ttest_i18ncmp expected current\n+'\n+\n test_expect_success 'apply --numstat notices binary file change' '\n \tgit diff >diff &&\n \tgit apply --numstat <diff >current &&\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"193744","messageId":"3fe3171f891450f6a7ecc04051f4c0c5e467df3d.1339796363.git.eclipse7@gmx.net","threadId":"30823","inReplyTo":"eae8caaf80d3bc90051de3f8f022bda01016bfd8.1339796363.git.eclipse7@gmx.net","subject":"[PATCH v3 2/2] t4012: Check binary only change with --shortstat","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-06-15T21:51:24Z","receivedAt":"2012-06-15T21:51:24Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Expect to see files changed but with 0 insertions and 0 deletions,\nbecause we do not count line changes for binary file modifications.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\n---\n\n  This patch can be squashed into the first one if desirable.\n\n t/t4012-diff-binary.sh | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 7d03c1d..6cebb39 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -42,6 +42,12 @@ test_expect_success 'diff --shortstat output for binary file change' '\n \ttest_i18ncmp expected current\n '\n \n+test_expect_success 'diff --shortstat output for binary file change only' '\n+\techo \" 1 file changed, 0 insertions(+), 0 deletions(-)\" >expected &&\n+\tgit diff --shortstat -- b >current &&\n+\ttest_i18ncmp expected current\n+'\n+\n test_expect_success 'apply --numstat notices binary file change' '\n \tgit diff >diff &&\n \tgit apply --numstat <diff >current &&\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"193745","messageId":"7vpq908cc8.fsf@alter.siamese.dyndns.org","threadId":"30823","inReplyTo":"eae8caaf80d3bc90051de3f8f022bda01016bfd8.1339796363.git.eclipse7@gmx.net","subject":"Re: [PATCH v3 1/2] diff: Only count lines in show_shortstats","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-15T22:00:39Z","receivedAt":"2012-06-15T22:00:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexander Strasser <eclipse7@gmx.net> writes:\n\n> Do not mix byte and line counts. Binary files have byte counts;\n> skip them when accumulating line insertions/deletions.\n>\n> The regression was introduced in e18872b.\n\nThanks for a last-minute fix.  Will apply directly to 'master'.\n"}]}