{"thread":{"id":"27533","subject":"[PATCH] t/t7503-pre-commit-hook.sh: Add GIT_PREFIX tests","startedAt":"2011-06-02T09:26:25Z","lastAt":"2011-06-02T09:26:25Z","messageCount":1,"participants":["David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"169180","messageId":"1307006785-17529-1-git-send-email-davvid@gmail.com","threadId":"27533","inReplyTo":null,"subject":"[PATCH] t/t7503-pre-commit-hook.sh: Add GIT_PREFIX tests","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2011-06-02T09:26:25Z","receivedAt":"2011-06-02T09:26:25Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Ensure that the pre-commit hook has access to GIT_PREFIX.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nRequires da/git-prefix-everywhere currently in next\n\n t/t7503-pre-commit-hook.sh |   33 +++++++++++++++++++++++++++++++++\n 1 files changed, 33 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7503-pre-commit-hook.sh b/t/t7503-pre-commit-hook.sh\nindex 8528f64..ee7f0cd 100755\n--- a/t/t7503-pre-commit-hook.sh\n+++ b/t/t7503-pre-commit-hook.sh\n@@ -84,5 +84,38 @@ test_expect_success POSIXPERM '--no-verify with non-executable hook' '\n \tgit commit --no-verify -m \"more content\"\n \n '\n+chmod +x \"$HOOK\"\n+\n+# a hook that checks $GIT_PREFIX and succeeds inside the\n+# success/ subdirectory only\n+cat > \"$HOOK\" <<EOF\n+#!/bin/sh\n+test \\$GIT_PREFIX = success/\n+EOF\n+\n+test_expect_success 'with hook requiring GIT_PREFIX' '\n+\n+\techo \"more content\" >> file &&\n+\tgit add file &&\n+\tmkdir success &&\n+\t(\n+\t\tcd success &&\n+\t\tgit commit -m \"hook requires GIT_PREFIX = success/\"\n+\t) &&\n+\trmdir success\n+'\n+\n+test_expect_success 'with failing hook requiring GIT_PREFIX' '\n+\n+\techo \"more content\" >> file &&\n+\tgit add file &&\n+\tmkdir fail &&\n+\t(\n+\t\tcd fail &&\n+\t\ttest_must_fail git commit -m \"hook must fail\"\n+\t) &&\n+\trmdir fail &&\n+\tgit checkout -- file\n+'\n \n test_done\n-- \n1.7.6.rc0.253.ga984a1\n"}]}