Skip to content

Commit

Permalink
test-lib: use subshell instead of cd $new && .. && cd $old
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ævar Arnfjörð Bjarmason authored and Junio C Hamano committed Aug 31, 2010
1 parent 07431fc commit 0d314ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,14 @@ 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"
"$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"
(
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
) || exit
}

test_done () {
Expand Down

0 comments on commit 0d314ce

Please sign in to comment.