git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] test-lib: use subshell instead of cd $new && .. && cd $old
@ 2010-08-30 12:00 Ævar Arnfjörð Bjarmason
  2010-08-30 15:57 ` Jonathan Nieder
  0 siblings, 1 reply; 6+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 12:00 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Carl Worth,
	Ævar Arnfjörð Bjarmason

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-31 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30 12:00 [PATCH] test-lib: use subshell instead of cd $new && .. && cd $old Ævar Arnfjörð Bjarmason
2010-08-30 15:57 ` 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

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).