git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Carl Worth" <cworth@cworth.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH] test-lib: use subshell instead of cd $new && .. && cd $old
Date: Mon, 30 Aug 2010 12:00:42 +0000	[thread overview]
Message-ID: <1283169642-21917-1-git-send-email-avarab@gmail.com> (raw)

Change the test_create_repo code added in v1.2.2~6 to use a subshell
instead of keeping track of the old working directory and cd-ing back
when it's done.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/test-lib.sh |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index dc934b8..778ba8d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -687,14 +687,12 @@ test_when_finished () {
 test_create_repo () {
 	test "$#" = 1 ||
 	error "bug in the test script: not 1 parameter to test-create-repo"
-	owd=`pwd`
 	repo="$1"
 	mkdir -p "$repo"
-	cd "$repo" || error "Cannot setup test environment"
+	(cd "$repo" || error "Cannot setup test environment"
 	"$GIT_EXEC_PATH/git-init" "--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
 	error "cannot run git init -- have you built things yet?"
-	mv .git/hooks .git/hooks-disabled
-	cd "$owd"
+	mv .git/hooks .git/hooks-disabled)
 }
 
 test_done () {
-- 
1.7.2.2.518.gf0ba8

             reply	other threads:[~2010-08-30 12:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 12:00 Ævar Arnfjörð Bjarmason [this message]
2010-08-30 15:57 ` [PATCH] test-lib: use subshell instead of cd $new && .. && cd $old Jonathan Nieder
2010-08-30 16:01   ` Ævar Arnfjörð Bjarmason
2010-08-30 16:04     ` Jonathan Nieder
2010-08-31 17:58   ` Junio C Hamano
2010-08-31 18:11     ` Ævar Arnfjörð Bjarmason

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=1283169642-21917-1-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=cworth@cworth.org \
    --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 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).