From: Jonathan Nieder Date: Mon, 30 Aug 2010 15:57:23 GMT Subject: Re: [PATCH] test-lib: use subshell instead of cd $new && .. && cd $old Message-ID: <20100830155723.GC3292@burratino> 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 ) ?