From: Richard Hansen Date: Sat, 10 Jan 2015 23:11:43 GMT Subject: [PATCH v2 2/2] t1020-subdirectory.sh: check hook pwd, $GIT_PREFIX Message-ID: <1420931503-22857-3-git-send-email-rhansen@bbn.com> In-Reply-To: <1420931503-22857-1-git-send-email-rhansen@bbn.com> Make sure hooks are executed at the top-level directory and that GIT_PREFIX is set (as documented). Signed-off-by: Richard Hansen --- t/t1020-subdirectory.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh index 2edb4f2..0ccbb7e 100755 --- a/t/t1020-subdirectory.sh +++ b/t/t1020-subdirectory.sh @@ -128,6 +128,17 @@ test_expect_success !MINGW '!alias expansion' ' test_cmp expect actual ' +test_expect_success 'hook pwd' ' + rm -f actual && + mkdir -p .git/hooks && + write_script .git/hooks/post-checkout <<-\EOF && + pwd >actual + EOF + test_when_finished "rm -f .git/hooks/post-checkout actual" && + (cd dir && git checkout -- two) && + test_path_is_file actual +' + test_expect_success 'GIT_PREFIX for !alias' ' printf "dir/" >expect && ( @@ -154,6 +165,18 @@ test_expect_success 'GIT_PREFIX for built-ins' ' test_cmp expect actual ' +test_expect_success 'GIT_PREFIX for hooks' ' + printf "dir/" >expect && + rm -f actual && + mkdir -p .git/hooks && + write_script .git/hooks/post-checkout <<-\EOF && + printf %s "$GIT_PREFIX" >actual + EOF + test_when_finished "rm -f .git/hooks/post-checkout expect actual" && + (cd dir && git checkout -- two) && + test_cmp expect actual +' + test_expect_success 'no file/rev ambiguity check inside .git' ' git commit -a -m 1 && ( -- 2.2.1