{"thread":{"id":"30997","subject":"[PATCH 0/6] Cleaning up t4012","startedAt":"2012-07-11T22:11:40Z","lastAt":"2012-07-16T21:11:05Z","messageCount":13,"participants":["Alexander Strasser","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"194938","messageId":"20120711221140.GA21303@akuma","threadId":"30997","inReplyTo":null,"subject":"[PATCH 0/6] Cleaning up t4012","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-11T22:11:40Z","receivedAt":"2012-07-11T22:11:40Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Hi,\n\n  during my recent bug hunting expedition I had the honor to modify\nt/t4012-diff-binary.sh . After submitting my previous patch set it\nquickly became clear that this file does not adhere to currently\npracticed style of Git tests.\n\n  It took me some time to get back to this but here finally comes a\npatch set to modernize t4012. While this patch set did not confront\nme with great conceptual problems it still is a bit problematic and\ndepends to some point on personal preferences. That is part of the\nreason why I tried to make as small and focused commits as possible.\n(Other part is I find it easier to review/manage my changes for myself\nwith a finer commit granularity). The patches can still be squashed\ntogether after review if this is preferred.\n\n  Also thanks again to Zbigniew who pointed out most of the addressed\nissues.\n\nAlexander Strasser (6):\n  t4012: Use different style for quoting\n  t4012: Unquote git command fragment in test title\n  t4012: Actually quote the sed script\n  t4012: Break up pipe into serial redirections\n  t4012: Re-indent test snippets\n  t4012: Make --shortstat more robust\n\n t/t4012-diff-binary.sh | 92 +++++++++++++++++++++++++++-----------------------\n 1 file changed, 49 insertions(+), 43 deletions(-)\n\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"194952","messageId":"4FFE7913.3090500@viscovery.net","threadId":"30997","inReplyTo":"20120711221140.GA21303@akuma","subject":"[PATCH 7/6?] t4012: use 'printf' instead of 'dd' to generate a binary file","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-07-12T07:13:23Z","receivedAt":"2012-07-12T07:13:23Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nFor some reason, 'echo X | dd bs=1k seek=1' creates a file with 2050 bytes\non Windows instead of the expected 1026 bytes, so that a test fails. Since\nthe actual contents of the file are irrelevant as long as there is at\nleast one zero byte so that the diff machinery recognizes it as binary,\nuse printf to generate it.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n While the focus is on t4012, maybe you can add this patch to the series.\n\n t/t4012-diff-binary.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 6cebb39..8c018ab 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -125,7 +125,7 @@ cat >expect <<EOF\n EOF\n \n test_expect_success 'diff --stat with binary files and big change count' '\n-\techo X | dd of=binfile bs=1k seek=1 &&\n+\tprintf \"\\01\\00%1024d\" 1 >binfile &&\n \tgit add binfile &&\n \ti=0 &&\n \twhile test $i -lt 10000; do\n-- \n1.7.11.1.1304.g11834c6\n"},{"id":"194991","messageId":"20120712222540.GA2782@akuma","threadId":"30997","inReplyTo":"4FFE7913.3090500@viscovery.net","subject":"Re: [PATCH 7/6?] t4012: use 'printf' instead of 'dd' to generate a binary file","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-12T22:25:40Z","receivedAt":"2012-07-12T22:25:40Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Hi, \n\nJohannes Sixt wrote:\n> From: Johannes Sixt <j6t@kdbg.org>\n> \n> For some reason, 'echo X | dd bs=1k seek=1' creates a file with 2050 bytes\n> on Windows instead of the expected 1026 bytes, so that a test fails. Since\n> the actual contents of the file are irrelevant as long as there is at\n> least one zero byte so that the diff machinery recognizes it as binary,\n> use printf to generate it.\n> \n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  While the focus is on t4012, maybe you can add this patch to the series.\n\n  Your patch looks good to me and works here. If I hear no\nobjections I will include it as number 7 when resending this\nseries.\n\n  Alexander\n\n>  t/t4012-diff-binary.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\n> index 6cebb39..8c018ab 100755\n> --- a/t/t4012-diff-binary.sh\n> +++ b/t/t4012-diff-binary.sh\n> @@ -125,7 +125,7 @@ cat >expect <<EOF\n>  EOF\n>  \n>  test_expect_success 'diff --stat with binary files and big change count' '\n> -\techo X | dd of=binfile bs=1k seek=1 &&\n> +\tprintf \"\\01\\00%1024d\" 1 >binfile &&\n>  \tgit add binfile &&\n>  \ti=0 &&\n>  \twhile test $i -lt 10000; do\n> -- \n> 1.7.11.1.1304.g11834c6\n"},{"id":"195167","messageId":"cover.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"20120711221140.GA21303@akuma","subject":"[PATCH v2 0/8] Cleaning up t4012","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:40:07Z","receivedAt":"2012-07-16T20:40:07Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Hi,\n\n  here goes the reroll. I corrected the spelling errors pointed out\nby Zbigniew and appended another patch for replacing the if-else\n\"Did the command fail?\" constructs with test_must_fail.\n\n  I based this series on the as/t4012-style-updates branch pushed by\nJunio. So his fixes are included too.\n\n\nAlexander Strasser (7):\n  t4012: modernize style for quoting\n  t4012: Unquote git command fragment in test title\n  t4012: Actually quote the sed script\n  t4012: Break up pipe into serial redirections\n  t4012: Make --shortstat test more robust\n  t4012: Re-indent test snippets\n  t4012: Use test_must_fail instead of if-else\n\nJohannes Sixt (1):\n  t4012: use 'printf' instead of 'dd' to generate a binary file\n\n t/t4012-diff-binary.sh | 94 +++++++++++++++++++++++---------------------------\n 1 file changed, 44 insertions(+), 50 deletions(-)\n\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195168","messageId":"0139a133d8c46a149e0456976a447a7f271d5104.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 1/8] t4012: modernize style for quoting","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:43:18Z","receivedAt":"2012-07-16T20:43:18Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"This quoting style is used by all newly added test code.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4012-diff-binary.sh | 35 ++++++++++++++++++++---------------\n 1 file changed, 20 insertions(+), 15 deletions(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 6cebb39..2a8b68e 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -15,13 +15,14 @@ cat >expect.binary-numstat <<\\EOF\n -\t-\td\n EOF\n \n-test_expect_success 'prepare repository' \\\n-\t'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&\n+test_expect_success 'prepare repository' '\n+\t echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&\n \t git update-index --add a b c d &&\n \t echo git >a &&\n \t cat \"$TEST_DIRECTORY\"/test-binary-1.png >b &&\n \t echo git >c &&\n-\t cat b b >d'\n+\t cat b b >d\n+'\n \n cat > expected <<\\EOF\n  a |    2 +-\n@@ -62,8 +63,8 @@ test_expect_success 'apply --numstat understands diff --binary format' '\n \n # apply needs to be able to skip the binary material correctly\n # in order to report the line number of a corrupt patch.\n-test_expect_success 'apply detecting corrupt patch correctly' \\\n-\t'git diff | sed -e 's/-CIT/xCIT/' >broken &&\n+test_expect_success 'apply detecting corrupt patch correctly' '\n+\t git diff | sed -e 's/-CIT/xCIT/' >broken &&\n \t if git apply --stat --summary broken 2>detected\n \t then\n \t\techo unhappy - should have detected an error\n@@ -74,10 +75,11 @@ test_expect_success 'apply detecting corrupt patch correctly' \\\n \t detected=`cat detected` &&\n \t detected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n \t detected=`sed -ne \"${detected}p\" broken` &&\n-\t test \"$detected\" = xCIT'\n+\t test \"$detected\" = xCIT\n+'\n \n-test_expect_success 'apply detecting corrupt patch correctly' \\\n-\t'git diff --binary | sed -e 's/-CIT/xCIT/' >broken &&\n+test_expect_success 'apply detecting corrupt patch correctly' '\n+\t git diff --binary | sed -e 's/-CIT/xCIT/' >broken &&\n \t if git apply --stat --summary broken 2>detected\n \t then\n \t\techo unhappy - should have detected an error\n@@ -88,23 +90,26 @@ test_expect_success 'apply detecting corrupt patch correctly' \\\n \t detected=`cat detected` &&\n \t detected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n \t detected=`sed -ne \"${detected}p\" broken` &&\n-\t test \"$detected\" = xCIT'\n+\t test \"$detected\" = xCIT\n+'\n \n test_expect_success 'initial commit' 'git commit -a -m initial'\n \n # Try removal (b), modification (d), and creation (e).\n-test_expect_success 'diff-index with --binary' \\\n-\t'echo AIT >a && mv b e && echo CIT >c && cat e >d &&\n+test_expect_success 'diff-index with --binary' '\n+\t echo AIT >a && mv b e && echo CIT >c && cat e >d &&\n \t git update-index --add --remove a b c d e &&\n \t tree0=`git write-tree` &&\n \t git diff --cached --binary >current &&\n-\t git apply --stat --summary current'\n+\t git apply --stat --summary current\n+'\n \n-test_expect_success 'apply binary patch' \\\n-\t'git reset --hard &&\n+test_expect_success 'apply binary patch' '\n+\t git reset --hard &&\n \t git apply --binary --index <current &&\n \t tree1=`git write-tree` &&\n-\t test \"$tree1\" = \"$tree0\"'\n+\t test \"$tree1\" = \"$tree0\"\n+'\n \n test_expect_success 'diff --no-index with binary creation' '\n \techo Q | q_to_nul >binary &&\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195176","messageId":"5cc05d1229d56ad1577e1f43524a9f9c57f78325.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 2/8] t4012: Unquote git command fragment in test title","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:43:39Z","receivedAt":"2012-07-16T20:43:39Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"The command fragments are quoted nowhere else in title texts of\nthis file, thus make this one consistent with all other titles.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4012-diff-binary.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 2a8b68e..3c54269 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -31,7 +31,7 @@ cat > expected <<\\EOF\n  d |  Bin\n  4 files changed, 2 insertions(+), 2 deletions(-)\n EOF\n-test_expect_success '\"apply --stat\" output for binary file change' '\n+test_expect_success 'apply --stat output for binary file change' '\n \tgit diff >diff &&\n \tgit apply --stat --summary <diff >current &&\n \ttest_i18ncmp expected current\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195169","messageId":"dac7fe6c66facf9bdecbe4764a7036ec3e6663fa.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 3/8] t4012: Actually quote the sed script","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:43:58Z","receivedAt":"2012-07-16T20:43:58Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"The nested quoting is not needed in this cases, thus the previous\nversion did work just fine. Nevertheless the usage is misleading,\nso just achieve nested quoting by using double quotes instead. Lower\nthe probability of breakage in the future and make the code easier\nto read.\n\nNOTE: Just dropping the single quotes around the sed arguments would\n      have also been possible.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4012-diff-binary.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 3c54269..60c2f6c 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -64,7 +64,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '\n # apply needs to be able to skip the binary material correctly\n # in order to report the line number of a corrupt patch.\n test_expect_success 'apply detecting corrupt patch correctly' '\n-\t git diff | sed -e 's/-CIT/xCIT/' >broken &&\n+\t git diff | sed -e \"s/-CIT/xCIT/\" >broken &&\n \t if git apply --stat --summary broken 2>detected\n \t then\n \t\techo unhappy - should have detected an error\n@@ -79,7 +79,7 @@ test_expect_success 'apply detecting corrupt patch correctly' '\n '\n \n test_expect_success 'apply detecting corrupt patch correctly' '\n-\t git diff --binary | sed -e 's/-CIT/xCIT/' >broken &&\n+\t git diff --binary | sed -e \"s/-CIT/xCIT/\" >broken &&\n \t if git apply --stat --summary broken 2>detected\n \t then\n \t\techo unhappy - should have detected an error\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195170","messageId":"e286cf77f4b9af3f2b45e36923ea6530c648e76a.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 4/8] t4012: Break up pipe into serial redirections","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:44:30Z","receivedAt":"2012-07-16T20:44:30Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Do not hide possible git errors by masking its process\nexit status.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4012-diff-binary.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 60c2f6c..daf8234 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -64,7 +64,8 @@ test_expect_success 'apply --numstat understands diff --binary format' '\n # apply needs to be able to skip the binary material correctly\n # in order to report the line number of a corrupt patch.\n test_expect_success 'apply detecting corrupt patch correctly' '\n-\t git diff | sed -e \"s/-CIT/xCIT/\" >broken &&\n+\t git diff >output &&\n+\t sed -e \"s/-CIT/xCIT/\" <output >broken &&\n \t if git apply --stat --summary broken 2>detected\n \t then\n \t\techo unhappy - should have detected an error\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195171","messageId":"4b210ed8738abd946521883ae14a885543d720da.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 5/8] t4012: Make --shortstat test more robust","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:45:10Z","receivedAt":"2012-07-16T20:45:10Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"The --shortstat test depends on the same scenario as the --stat\ntest. Use the part of the same expected result for the --stat test\nto avoid duplicating it manually.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4012-diff-binary.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex daf8234..4767761 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -38,9 +38,9 @@ test_expect_success 'apply --stat output for binary file change' '\n '\n \n test_expect_success 'diff --shortstat output for binary file change' '\n-\techo \" 4 files changed, 2 insertions(+), 2 deletions(-)\" >expected &&\n+\ttail -n 1 expected >expect &&\n \tgit diff --shortstat >current &&\n-\ttest_i18ncmp expected current\n+\ttest_i18ncmp expect current\n '\n \n test_expect_success 'diff --shortstat output for binary file change only' '\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195172","messageId":"7e7734764f24b17a1d2cd1205de7222a29723d35.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 6/8] t4012: Re-indent test snippets","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:45:40Z","receivedAt":"2012-07-16T20:45:40Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Most one-level indents were 1 HT (horizontal tab) followed by 1 SP.\nRemove the SP.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4012-diff-binary.sh | 68 +++++++++++++++++++++++++-------------------------\n 1 file changed, 34 insertions(+), 34 deletions(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 4767761..7b0e759 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -16,12 +16,12 @@ cat >expect.binary-numstat <<\\EOF\n EOF\n \n test_expect_success 'prepare repository' '\n-\t echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&\n-\t git update-index --add a b c d &&\n-\t echo git >a &&\n-\t cat \"$TEST_DIRECTORY\"/test-binary-1.png >b &&\n-\t echo git >c &&\n-\t cat b b >d\n+\techo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&\n+\tgit update-index --add a b c d &&\n+\techo git >a &&\n+\tcat \"$TEST_DIRECTORY\"/test-binary-1.png >b &&\n+\techo git >c &&\n+\tcat b b >d\n '\n \n cat > expected <<\\EOF\n@@ -64,52 +64,52 @@ test_expect_success 'apply --numstat understands diff --binary format' '\n # apply needs to be able to skip the binary material correctly\n # in order to report the line number of a corrupt patch.\n test_expect_success 'apply detecting corrupt patch correctly' '\n-\t git diff >output &&\n-\t sed -e \"s/-CIT/xCIT/\" <output >broken &&\n-\t if git apply --stat --summary broken 2>detected\n-\t then\n+\tgit diff >output &&\n+\tsed -e \"s/-CIT/xCIT/\" <output >broken &&\n+\tif git apply --stat --summary broken 2>detected\n+\tthen\n \t\techo unhappy - should have detected an error\n \t\t(exit 1)\n-\t else\n+\telse\n \t\techo happy\n-\t fi &&\n-\t detected=`cat detected` &&\n-\t detected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n-\t detected=`sed -ne \"${detected}p\" broken` &&\n-\t test \"$detected\" = xCIT\n+\tfi &&\n+\tdetected=`cat detected` &&\n+\tdetected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n+\tdetected=`sed -ne \"${detected}p\" broken` &&\n+\ttest \"$detected\" = xCIT\n '\n \n test_expect_success 'apply detecting corrupt patch correctly' '\n-\t git diff --binary | sed -e \"s/-CIT/xCIT/\" >broken &&\n-\t if git apply --stat --summary broken 2>detected\n-\t then\n+\tgit diff --binary | sed -e \"s/-CIT/xCIT/\" >broken &&\n+\tif git apply --stat --summary broken 2>detected\n+\tthen\n \t\techo unhappy - should have detected an error\n \t\t(exit 1)\n-\t else\n+\telse\n \t\techo happy\n-\t fi &&\n-\t detected=`cat detected` &&\n-\t detected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n-\t detected=`sed -ne \"${detected}p\" broken` &&\n-\t test \"$detected\" = xCIT\n+\tfi &&\n+\tdetected=`cat detected` &&\n+\tdetected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n+\tdetected=`sed -ne \"${detected}p\" broken` &&\n+\ttest \"$detected\" = xCIT\n '\n \n test_expect_success 'initial commit' 'git commit -a -m initial'\n \n # Try removal (b), modification (d), and creation (e).\n test_expect_success 'diff-index with --binary' '\n-\t echo AIT >a && mv b e && echo CIT >c && cat e >d &&\n-\t git update-index --add --remove a b c d e &&\n-\t tree0=`git write-tree` &&\n-\t git diff --cached --binary >current &&\n-\t git apply --stat --summary current\n+\techo AIT >a && mv b e && echo CIT >c && cat e >d &&\n+\tgit update-index --add --remove a b c d e &&\n+\ttree0=`git write-tree` &&\n+\tgit diff --cached --binary >current &&\n+\tgit apply --stat --summary current\n '\n \n test_expect_success 'apply binary patch' '\n-\t git reset --hard &&\n-\t git apply --binary --index <current &&\n-\t tree1=`git write-tree` &&\n-\t test \"$tree1\" = \"$tree0\"\n+\tgit reset --hard &&\n+\tgit apply --binary --index <current &&\n+\ttree1=`git write-tree` &&\n+\ttest \"$tree1\" = \"$tree0\"\n '\n \n test_expect_success 'diff --no-index with binary creation' '\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195174","messageId":"d831ad4226688aa8ca2b3b152e242e357adbb3b2.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 7/8] t4012: use 'printf' instead of 'dd' to generate a binary file","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:46:56Z","receivedAt":"2012-07-16T20:46:56Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"From: Johannes Sixt <j6t@kdbg.org>\n\nFor some reason, 'echo X | dd bs=1k seek=1' creates a file with 2050 bytes\non Windows instead of the expected 1026 bytes, so that a test fails. Since\nthe actual contents of the file are irrelevant as long as there is at\nleast one zero byte so that the diff machinery recognizes it as binary,\nuse printf to generate it.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\n---\n t/t4012-diff-binary.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 7b0e759..077870e 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -131,7 +131,7 @@ cat >expect <<EOF\n EOF\n \n test_expect_success 'diff --stat with binary files and big change count' '\n-\techo X | dd of=binfile bs=1k seek=1 &&\n+\tprintf \"\\01\\00%1024d\" 1 >binfile &&\n \tgit add binfile &&\n \ti=0 &&\n \twhile test $i -lt 10000; do\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195175","messageId":"629b1abf980cd9aac28ae8c55dd52a9124c15b55.1342468069.git.eclipse7@gmx.net","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"[PATCH v2 8/8] t4012: Use test_must_fail instead of if-else","fromName":"Alexander Strasser","fromEmail":"eclipse7@gmx.net","sentAt":"2012-07-16T20:47:22Z","receivedAt":"2012-07-16T20:47:22Z","isPatch":true,"sender":{"key":"eclipse7@gmx.net","avatar":"https://avatars.githubusercontent.com/u/4342576?v=4"},"body":"Make the code less bulky and easier to read. Also do not overlook\nfailures like e.g. git failing because of unexpected signals.\n\nSigned-off-by: Alexander Strasser <eclipse7@gmx.net>\n---\n t/t4012-diff-binary.sh | 16 ++--------------\n 1 file changed, 2 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 077870e..ec4deea 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -66,13 +66,7 @@ test_expect_success 'apply --numstat understands diff --binary format' '\n test_expect_success 'apply detecting corrupt patch correctly' '\n \tgit diff >output &&\n \tsed -e \"s/-CIT/xCIT/\" <output >broken &&\n-\tif git apply --stat --summary broken 2>detected\n-\tthen\n-\t\techo unhappy - should have detected an error\n-\t\t(exit 1)\n-\telse\n-\t\techo happy\n-\tfi &&\n+\ttest_must_fail git apply --stat --summary broken 2>detected &&\n \tdetected=`cat detected` &&\n \tdetected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n \tdetected=`sed -ne \"${detected}p\" broken` &&\n@@ -81,13 +75,7 @@ test_expect_success 'apply detecting corrupt patch correctly' '\n \n test_expect_success 'apply detecting corrupt patch correctly' '\n \tgit diff --binary | sed -e \"s/-CIT/xCIT/\" >broken &&\n-\tif git apply --stat --summary broken 2>detected\n-\tthen\n-\t\techo unhappy - should have detected an error\n-\t\t(exit 1)\n-\telse\n-\t\techo happy\n-\tfi &&\n+\ttest_must_fail git apply --stat --summary broken 2>detected &&\n \tdetected=`cat detected` &&\n \tdetected=`expr \"$detected\" : \"fatal.*at line \\\\([0-9]*\\\\)\\$\"` &&\n \tdetected=`sed -ne \"${detected}p\" broken` &&\n-- \n1.7.10.2.552.gaa3bb87\n"},{"id":"195177","messageId":"7vsjcrza1i.fsf@alter.siamese.dyndns.org","threadId":"30997","inReplyTo":"cover.1342468069.git.eclipse7@gmx.net","subject":"Re: [PATCH v2 0/8] Cleaning up t4012","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T21:11:05Z","receivedAt":"2012-07-16T21:11:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"All looked reasonable; thanks folks.  Will requeue and advance it to\n'next'.\n"}]}