{"thread":{"id":"29789","subject":"[PATCH] t4011: modernise style","startedAt":"2012-02-29T23:45:26Z","lastAt":"2012-03-01T19:59:09Z","messageCount":3,"participants":["Junio C Hamano","Stefano Lattarini"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"185752","messageId":"7vipipqk4p.fsf@alter.siamese.dyndns.org","threadId":"29789","inReplyTo":null,"subject":"[PATCH] t4011: modernise style","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-29T23:45:26Z","receivedAt":"2012-02-29T23:45:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Match the style to more modern test scripts, namely:\n\n - The first line of each test has prereq, title and opening sq for the\n   script body.  This makes the test shorter while reducing the need for\n   backquotes.\n\n - Be prepared for the case the previous test may have failed.  If a test\n   wants to start from not having 'frotz' that the previous test may have\n   created, write \"rm -f frotz\", not \"rm frotz\".\n\n - Prepare the expected output inside your own test.\n\n - The order of comparison to check the result is \"diff expected actual\",\n   so that the output will show how the output from the git you just broke\n   is different from what is expected.\n\n - Write no SP between redirection '>' (or '<' for that matter) and the\n   filename.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n * Just what I happened to have noticed today.\n\n t/t4011-diff-symlink.sh |  168 +++++++++++++++++++++++------------------------\n 1 file changed, 82 insertions(+), 86 deletions(-)\n\ndiff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh\nindex 408a19c..0e1216f 100755\n--- a/t/t4011-diff-symlink.sh\n+++ b/t/t4011-diff-symlink.sh\n@@ -9,85 +9,81 @@ test_description='Test diff of symlinks.\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/diff-lib.sh\n \n-cat > expected << EOF\n-diff --git a/frotz b/frotz\n-new file mode 120000\n-index 0000000..7c465af\n---- /dev/null\n-+++ b/frotz\n-@@ -0,0 +1 @@\n-+xyzzy\n-\\ No newline at end of file\n-EOF\n-\n-test_expect_success SYMLINKS \\\n-    'diff new symlink' \\\n-    'ln -s xyzzy frotz &&\n-    git update-index &&\n-    tree=$(git write-tree) &&\n-    git update-index --add frotz &&\n-    GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree > current &&\n-    compare_diff_patch current expected'\n-\n-test_expect_success SYMLINKS \\\n-    'diff unchanged symlink' \\\n-    'tree=$(git write-tree) &&\n-    git update-index frotz &&\n-    test -z \"$(git diff-index --name-only $tree)\"'\n-\n-cat > expected << EOF\n-diff --git a/frotz b/frotz\n-deleted file mode 120000\n-index 7c465af..0000000\n---- a/frotz\n-+++ /dev/null\n-@@ -1 +0,0 @@\n--xyzzy\n-\\ No newline at end of file\n-EOF\n-\n-test_expect_success SYMLINKS \\\n-    'diff removed symlink' \\\n-    'mv frotz frotz2 &&\n-    git diff-index -M -p $tree > current &&\n-    compare_diff_patch current expected'\n+test_expect_success SYMLINKS 'diff new symlink' '\n+\tcat >expected <<-\\EOF &&\n+\tdiff --git a/frotz b/frotz\n+\tnew file mode 120000\n+\tindex 0000000..7c465af\n+\t--- /dev/null\n+\t+++ b/frotz\n+\t@@ -0,0 +1 @@\n+\t+xyzzy\n+\t\\ No newline at end of file\n+\tEOF\n+\tln -s xyzzy frotz &&\n+\tgit update-index &&\n+\ttree=$(git write-tree) &&\n+\tgit update-index --add frotz &&\n+\tGIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree >current &&\n+\tcompare_diff_patch expected current\n+'\n \n-cat > expected << EOF\n-diff --git a/frotz b/frotz\n-EOF\n+test_expect_success SYMLINKS 'diff unchanged symlink'  '\n+\tcat >expected <<-\\EOF &&\n+\tdiff --git a/frotz b/frotz\n+\tdeleted file mode 120000\n+\tindex 7c465af..0000000\n+\t--- a/frotz\n+\t+++ /dev/null\n+\t@@ -1 +0,0 @@\n+\t-xyzzy\n+\t\\ No newline at end of file\n+\tEOF\n+\ttree=$(git write-tree) &&\n+\tgit update-index frotz &&\n+\ttest -z \"$(git diff-index --name-only $tree)\"\n+'\n \n-test_expect_success SYMLINKS \\\n-    'diff identical, but newly created symlink' \\\n-    'ln -s xyzzy frotz &&\n-    git diff-index -M -p $tree > current &&\n-    compare_diff_patch current expected'\n+test_expect_success SYMLINKS 'diff removed symlink' '\n+\tmv frotz frotz2 &&\n+\tgit diff-index -M -p $tree >current &&\n+\tcompare_diff_patch expected current\n+'\n \n-cat > expected << EOF\n-diff --git a/frotz b/frotz\n-index 7c465af..df1db54 120000\n---- a/frotz\n-+++ b/frotz\n-@@ -1 +1 @@\n--xyzzy\n-\\ No newline at end of file\n-+yxyyz\n-\\ No newline at end of file\n-EOF\n+test_expect_success SYMLINKS 'diff identical, but newly created symlink' '\n+\tcat >expected <<-\\EOF &&\n+\tdiff --git a/frotz b/frotz\n+\tEOF\n+\tln -s xyzzy frotz &&\n+\tgit diff-index -M -p $tree >current &&\n+\tcompare_diff_patch expected current\n+'\n \n-test_expect_success SYMLINKS \\\n-    'diff different symlink' \\\n-    'rm frotz &&\n-    ln -s yxyyz frotz &&\n-    git diff-index -M -p $tree > current &&\n-    compare_diff_patch current expected'\n+test_expect_success SYMLINKS 'diff different symlink' '\n+\tcat >expected <<-\\EOF &&\n+\tdiff --git a/frotz b/frotz\n+\tindex 7c465af..df1db54 120000\n+\t--- a/frotz\n+\t+++ b/frotz\n+\t@@ -1 +1 @@\n+\t-xyzzy\n+\t\\ No newline at end of file\n+\t+yxyyz\n+\t\\ No newline at end of file\n+\tEOF\n+\trm -f frotz &&\n+\tln -s yxyyz frotz &&\n+\tgit diff-index -M -p $tree >current &&\n+\tcompare_diff_patch expected current\n+'\n \n-test_expect_success SYMLINKS \\\n-    'diff symlinks with non-existing targets' \\\n-    'ln -s narf pinky &&\n-    ln -s take\\ over brain &&\n-    test_must_fail git diff --no-index pinky brain > output 2> output.err &&\n-    grep narf output &&\n-    ! grep error output.err'\n+test_expect_success SYMLINKS 'diff symlinks with non-existing targets' '\n+\tln -s narf pinky &&\n+\tln -s take\\ over brain &&\n+\ttest_must_fail git diff --no-index pinky brain >output 2>output.err &&\n+\tgrep narf output &&\n+\t! test -s output.err\n+'\n \n test_expect_success SYMLINKS 'setup symlinks with attributes' '\n \techo \"*.bin diff=bin\" >>.gitattributes &&\n@@ -96,19 +92,19 @@ test_expect_success SYMLINKS 'setup symlinks with attributes' '\n \tgit add -N file.bin link.bin\n '\n \n-cat >expect <<'EOF'\n-diff --git a/file.bin b/file.bin\n-index e69de29..d95f3ad 100644\n-Binary files a/file.bin and b/file.bin differ\n-diff --git a/link.bin b/link.bin\n-index e69de29..dce41ec 120000\n---- a/link.bin\n-+++ b/link.bin\n-@@ -0,0 +1 @@\n-+file.bin\n-\\ No newline at end of file\n-EOF\n test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' '\n+\tcat >expect <<-\\EOF &&\n+\tdiff --git a/file.bin b/file.bin\n+\tindex e69de29..d95f3ad 100644\n+\tBinary files a/file.bin and b/file.bin differ\n+\tdiff --git a/link.bin b/link.bin\n+\tindex e69de29..dce41ec 120000\n+\t--- a/link.bin\n+\t+++ b/link.bin\n+\t@@ -0,0 +1 @@\n+\t+file.bin\n+\t\\ No newline at end of file\n+\tEOF\n \tgit config diff.bin.binary true &&\n \tgit diff file.bin link.bin >actual &&\n \ttest_cmp expect actual\n"},{"id":"185846","messageId":"4F4FD21C.9060403@gmail.com","threadId":"29789","inReplyTo":"7vipipqk4p.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t4011: modernise style","fromName":"Stefano Lattarini","fromEmail":"stefano.lattarini@gmail.com","sentAt":"2012-03-01T19:46:36Z","receivedAt":"2012-03-01T19:46:36Z","isPatch":true,"sender":{"key":"stefano.lattarini@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1429199?v=4"},"body":"Hi Junio.\n\nI've noted a possible typo in the commit message ...\n\nOn 03/01/2012 12:45 AM, Junio C Hamano wrote:\n> Match the style to more modern test scripts, namely:\n> \n>  - The first line of each test has prereq, title and opening sq for the\n>    script body.  This makes the test shorter while reducing the need for\n>    backquotes.\n>\nDid you intend \"backslashes\" instead of \"backquotes\" here?\n\nRegards,\n  Stefano\n"},{"id":"185847","messageId":"7v7gz4m6sy.fsf@alter.siamese.dyndns.org","threadId":"29789","inReplyTo":"4F4FD21C.9060403@gmail.com","subject":"Re: [PATCH] t4011: modernise style","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-01T19:59:09Z","receivedAt":"2012-03-01T19:59:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefano Lattarini <stefano.lattarini@gmail.com> writes:\n\n> On 03/01/2012 12:45 AM, Junio C Hamano wrote:\n>> Match the style to more modern test scripts, namely:\n>> \n>>  - The first line of each test has prereq, title and opening sq for the\n>>    script body.  This makes the test shorter while reducing the need for\n>>    backquotes.\n>>\n> Did you intend \"backslashes\" instead of \"backquotes\" here?\n\nThanks.  I did have this funny feeling in my butt while writing it, but\ndidn't quite realize what was wrong ;-)\n\nWill fix.\n"}]}