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

Ævar Arnfjörð Bjarmason wrote:

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

Style: why not use

	(
		cd "$repo" ...
		... .git/hooks-disabled
	)

?

  reply	other threads:[~2010-08-30 15:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20100830155723.GC3292@burratino \
    --to=jrnieder@gmail.com \
    --cc=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).