{"thread":{"id":"11218","subject":"[PATCH] Style fixes for pre-commit hook tests","startedAt":"2007-12-10T07:42:45Z","lastAt":"2007-12-10T07:42:45Z","messageCount":1,"participants":["Wincent Colaiuta"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"62551","messageId":"1197272565-5588-1-git-send-email-win@wincent.com","threadId":"11218","inReplyTo":null,"subject":"[PATCH] Style fixes for pre-commit hook tests","fromName":"Wincent Colaiuta","fromEmail":"win@wincent.com","sentAt":"2007-12-10T07:42:45Z","receivedAt":"2007-12-10T07:42:45Z","isPatch":true,"sender":{"key":"greg@hurrell.net","avatar":"https://avatars.githubusercontent.com/u/7074?v=4"},"body":"As pointed out by Junio on the mailing list, surrounding tests in\ndouble quotes can lead to bugs wherein variables get substituted away,\nso this isn't just style churn but important to prevent others from\nlooking at these tests in the future and thinking that this is \"the\nway\" that Git tests should be written.\n\nSigned-off-by: Wincent Colaiuta <win@wincent.com>\n---\n t/t7503-pre-commit-hook.sh |   90 ++++++++++++++++++++++++++++----------------\n 1 files changed, 57 insertions(+), 33 deletions(-)\n\ndiff --git a/t/t7503-pre-commit-hook.sh b/t/t7503-pre-commit-hook.sh\nindex c8097a7..d787cac 100755\n--- a/t/t7503-pre-commit-hook.sh\n+++ b/t/t7503-pre-commit-hook.sh\n@@ -4,15 +4,21 @@ test_description='pre-commit hook'\n \n . ./test-lib.sh\n \n-test_expect_success \"with no hook\" \\\n-\t\"echo 'foo' > file &&\n-\t git add file &&\n-\t git commit -m 'first'\"\n+test_expect_success 'with no hook' '\n \n-test_expect_success \"--no-verify with no hook\" \\\n-\t\"echo 'bar' > file &&\n-\t git add file &&\n-\t git commit --no-verify -m 'bar'\"\n+\techo \"foo\" > file &&\n+\tgit add file &&\n+\tgit commit -m \"first\"\n+\n+'\n+\n+test_expect_success '--no-verify with no hook' '\n+\n+\techo \"bar\" > file &&\n+\tgit add file &&\n+\tgit commit --no-verify -m \"bar\"\n+\n+'\n \n # now install hook that always succeeds\n HOOKDIR=\"$(git rev-parse --git-dir)/hooks\"\n@@ -24,15 +30,21 @@ exit 0\n EOF\n chmod +x \"$HOOK\"\n \n-test_expect_success \"with succeeding hook\" \\\n-\t\"echo 'more' >> file &&\n-\t git add file &&\n-\t git commit -m 'more'\"\n+test_expect_success 'with succeeding hook' '\n+\n+\techo \"more\" >> file &&\n+\tgit add file &&\n+\tgit commit -m \"more\"\n \n-test_expect_success \"--no-verify with succeeding hook\" \\\n-\t\"echo 'even more' >> file &&\n-\t git add file &&\n-\t git commit --no-verify -m 'even more'\"\n+'\n+\n+test_expect_success '--no-verify with succeeding hook' '\n+\n+\techo \"even more\" >> file &&\n+\tgit add file &&\n+\tgit commit --no-verify -m \"even more\"\n+\n+'\n \n # now a hook that fails\n cat > \"$HOOK\" <<EOF\n@@ -40,25 +52,37 @@ cat > \"$HOOK\" <<EOF\n exit 1\n EOF\n \n-test_expect_failure \"with failing hook\" \\\n-\t\"echo 'another' >> file &&\n-\t git add file &&\n-\t git commit -m 'another'\"\n+test_expect_failure 'with failing hook' '\n+\n+\techo \"another\" >> file &&\n+\tgit add file &&\n+\tgit commit -m \"another\"\n \n-test_expect_success \"--no-verify with failing hook\" \\\n-\t\"echo 'stuff' >> file &&\n-\t git add file &&\n-\t git commit --no-verify -m 'stuff'\"\n+'\n+\n+test_expect_success '--no-verify with failing hook' '\n+\n+\techo \"stuff\" >> file &&\n+\tgit add file &&\n+\tgit commit --no-verify -m \"stuff\"\n+\n+'\n \n chmod -x \"$HOOK\"\n-test_expect_success \"with non-executable hook\" \\\n-\t\"echo 'content' >> file &&\n-\t git add file &&\n-\t git commit -m 'content'\"\n-\n-test_expect_success \"--no-verify with non-executable hook\" \\\n-\t\"echo 'more content' >> file &&\n-\t git add file &&\n-\t git commit --no-verify -m 'more content'\"\n+test_expect_success 'with non-executable hook' '\n+\n+\techo \"content\" >> file &&\n+\tgit add file &&\n+\tgit commit -m \"content\"\n+\n+'\n+\n+test_expect_success '--no-verify with non-executable hook' '\n+\n+\techo \"more content\" >> file &&\n+\tgit add file &&\n+\tgit commit --no-verify -m \"more content\"\n+\n+'\n \n test_done\n-- \n1.5.3.7.1116.gf11de\n"}]}