git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Hansen <rhansen@bbn.com>
To: 6t@kdbg.org
Cc: git@vger.kernel.org, rhansen@bbn.com
Subject: [PATCH v2 2/2] t1020-subdirectory.sh: check hook pwd, $GIT_PREFIX
Date: Sat, 10 Jan 2015 18:11:43 -0500	[thread overview]
Message-ID: <1420931503-22857-3-git-send-email-rhansen@bbn.com> (raw)
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 <rhansen@bbn.com>
---
 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

  parent reply	other threads:[~2015-01-10 23:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-10  6:49 [PATCH 0/2] Documentation/githooks: mention pwd, $GIT_PREFIX Richard Hansen
2015-01-10  6:49 ` [PATCH 1/2] " Richard Hansen
2015-01-10  6:49 ` [PATCH 2/2] t1020-subdirectory.sh: check hook " Richard Hansen
2015-01-10  8:25   ` Johannes Sixt
2015-01-10 23:11     ` [PATCH v2 0/2] Documentation/githooks: mention " Richard Hansen
2015-01-10 23:11       ` [PATCH v2 1/2] " Richard Hansen
2015-01-12 19:56         ` Junio C Hamano
2015-01-10 23:11       ` Richard Hansen [this message]
2015-01-12 22:38         ` [PATCH v2 2/2] t1020-subdirectory.sh: check hook " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420931503-22857-3-git-send-email-rhansen@bbn.com \
    --to=rhansen@bbn.com \
    --cc=6t@kdbg.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).