From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 3/3] t5403: do not use access repos with GIT_DIR when worktree is involved
Date: Wed, 12 Oct 2011 20:35:05 +1100 [thread overview]
Message-ID: <1318412105-13595-3-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1318412105-13595-1-git-send-email-pclouds@gmail.com>
Setting GIT_DIR alone means worktree is current directory for legacy
reasons. Avoid using that, instead go to the worktree and execute
commands there.
The troublesome command is "GIT_DIR=clone2/.git git add clone2/b". The
real worktree is clone2, but that command tells git worktree is $(pwd).
What does user expect to add then? Should the new entry in index be "b"
or "clone2/b"?
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/t5403-post-checkout-hook.sh | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index 6643f32..3459539 100755
--- a/t/t5403-post-checkout-hook.sh
+++ b/t/t5403-post-checkout-hook.sh
@@ -13,10 +13,13 @@ test_expect_success setup '
git commit -m setup &&
git clone ./. clone1 &&
git clone ./. clone2 &&
- GIT_DIR=clone2/.git git branch new2 &&
- echo Data for commit1. >clone2/b &&
- GIT_DIR=clone2/.git git add clone2/b &&
- GIT_DIR=clone2/.git git commit -m new2
+ (
+ cd clone2 &&
+ git branch new2 &&
+ echo Data for commit1. >b &&
+ git add b &&
+ git commit -m new2
+ )
'
for clone in 1 2; do
@@ -45,7 +48,7 @@ test_expect_success 'post-checkout runs as expected ' '
'
test_expect_success 'post-checkout args are correct with git checkout -b ' '
- GIT_DIR=clone1/.git git checkout -b new1 &&
+ ( cd clone1 && git checkout -b new1 ) &&
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
@@ -53,7 +56,7 @@ test_expect_success 'post-checkout args are correct with git checkout -b ' '
'
test_expect_success 'post-checkout receives the right args with HEAD changed ' '
- GIT_DIR=clone2/.git git checkout new2 &&
+ ( cd clone2 && git checkout new2 ) &&
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
@@ -61,7 +64,7 @@ test_expect_success 'post-checkout receives the right args with HEAD changed ' '
'
test_expect_success 'post-checkout receives the right args when not switching branches ' '
- GIT_DIR=clone2/.git git checkout master b &&
+ ( cd clone2 && git checkout master b ) &&
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
--
1.7.3.1.256.g2539c.dirty
next prev parent reply other threads:[~2011-10-12 9:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-12 9:35 [PATCH 1/3] t5403.1: simplify commit creation Nguyễn Thái Ngọc Duy
2011-10-12 9:35 ` [PATCH 2/3] t5403: convert leading spaces to tabs Nguyễn Thái Ngọc Duy
2011-10-12 9:35 ` Nguyễn Thái Ngọc Duy [this message]
2011-10-13 4:27 ` [PATCH 3/3] t5403: do not use access repos with GIT_DIR when worktree is involved Junio C Hamano
2011-10-13 4:54 ` Nguyen Thai Ngoc Duy
2011-10-12 14:14 ` [PATCH 1/3] t5403.1: simplify commit creation Johannes Sixt
2011-10-13 3:54 ` Nguyen Thai Ngoc Duy
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=1318412105-13595-3-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.