From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
git@vger.kernel.org, Carl Worth <cworth@cworth.org>
Subject: Re: [PATCH] test-lib: use subshell instead of cd $new && .. && cd $old
Date: Tue, 31 Aug 2010 18:11:30 +0000 [thread overview]
Message-ID: <AANLkTim7KWTR0FhnucZ7ROujZ-c7=y80Wz7UnR=+hsgZ@mail.gmail.com> (raw)
In-Reply-To: <7vaao2br58.fsf@alter.siamese.dyndns.org>
On Tue, Aug 31, 2010 at 17:58, Junio C Hamano <gitster@pobox.com> wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>> Æ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
>> )
>
> That is a sensible suggestion, but what does "error" do?
>
> I think you would need || exit at the end, i.e.
>
> (
> ... || error "..."
> ) || exit
>
> or something.
Good catch, yes. error() calls exit so this patch as-is introduces a
logic error.
prev parent reply other threads:[~2010-08-31 18:11 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
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 message]
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='AANLkTim7KWTR0FhnucZ7ROujZ-c7=y80Wz7UnR=+hsgZ@mail.gmail.com' \
--to=avarab@gmail.com \
--cc=cworth@cworth.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.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).