From 9b777a165e050f9a881a74a5902a8ddd2de30da5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 16 Aug 2010 09:25:01 -0700 Subject: cvs tests: do not touch test CVS repositories shipped with source Some tests in t96xx series (cvsimport) want to write into the control area (CVSROOT) of their test CVS repositories, but this does not work well when the source area is made read-only (test trash directories are moved via --root=else/where option). Copy the supplied test CVS repository to a scratch place at the beginning of these tests. Signed-off-by: Junio C Hamano --- t/lib-cvs.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't/lib-cvs.sh') diff --git a/t/lib-cvs.sh b/t/lib-cvs.sh index 648d1619c8..b51d2e13a6 100644 --- a/t/lib-cvs.sh +++ b/t/lib-cvs.sh @@ -30,6 +30,12 @@ case "$cvsps_version" in ;; esac +setup_cvs_test_repository () { + CVSROOT="$(pwd)/.cvsroot" && + cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" && + export CVSROOT +} + test_cvs_co () { # Usage: test_cvs_co BRANCH_NAME rm -rf module-cvs-"$1" -- cgit v1.2.3 From e4c62e640db3f704b4c27435c6b8efdb170988dc Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Mon, 30 Aug 2010 11:50:42 +0200 Subject: tests: factor HOME=$(pwd) in test-lib.sh The same pattern is used in many tests, and makes it easy for new ones to rely on $HOME being a trashable, clean, directory. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- t/lib-cvs.sh | 3 --- t/t0001-init.sh | 6 ------ t/t5601-clone.sh | 2 -- t/t9130-git-svn-authors-file.sh | 2 -- t/test-lib.sh | 3 +++ 5 files changed, 3 insertions(+), 13 deletions(-) (limited to 't/lib-cvs.sh') diff --git a/t/lib-cvs.sh b/t/lib-cvs.sh index b51d2e13a6..44263ade25 100644 --- a/t/lib-cvs.sh +++ b/t/lib-cvs.sh @@ -3,9 +3,6 @@ . ./test-lib.sh unset CVS_SERVER -# for clean cvsps cache -HOME=$(pwd) -export HOME if ! type cvs >/dev/null 2>&1 then diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 7a7599987a..7fe8883ae0 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -171,8 +171,6 @@ test_expect_success 'init with init.templatedir set' ' mkdir templatedir-source && echo Content >templatedir-source/file && ( - HOME="`pwd`" && - export HOME && test_config="${HOME}/.gitconfig" && git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" && mkdir templatedir-set && @@ -188,8 +186,6 @@ test_expect_success 'init with init.templatedir set' ' test_expect_success 'init --bare/--shared overrides system/global config' ' ( - HOME="`pwd`" && - export HOME && test_config="$HOME"/.gitconfig && unset GIT_CONFIG_NOGLOBAL && git config -f "$test_config" core.bare false && @@ -205,8 +201,6 @@ test_expect_success 'init --bare/--shared overrides system/global config' ' test_expect_success 'init honors global core.sharedRepository' ' ( - HOME="`pwd`" && - export HOME && test_config="$HOME"/.gitconfig && unset GIT_CONFIG_NOGLOBAL && git config -f "$test_config" core.sharedRepository 0666 && diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 8abb71afcd..8617965ec0 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -163,8 +163,6 @@ test_expect_success 'clone a void' ' test_expect_success 'clone respects global branch.autosetuprebase' ' ( - HOME=$(pwd) && - export HOME && test_config="$HOME/.gitconfig" && unset GIT_CONFIG_NOGLOBAL && git config -f "$test_config" branch.autosetuprebase remote && diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh index 134411e0a5..d5ee39ae9e 100755 --- a/t/t9130-git-svn-authors-file.sh +++ b/t/t9130-git-svn-authors-file.sh @@ -95,8 +95,6 @@ test_expect_success 'fresh clone with svn.authors-file in config' ' ( rm -r "$GIT_DIR" && test x = x"$(git config svn.authorsfile)" && - HOME="`pwd`" && - export HOME && test_config="$HOME"/.gitconfig && unset GIT_CONFIG_NOGLOBAL && unset GIT_DIR && diff --git a/t/test-lib.sh b/t/test-lib.sh index 7c9fe7ab42..67553f3dfc 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -865,6 +865,9 @@ test_create_repo "$test" # in subprocesses like git equals our $PWD (for pathname comparisons). cd -P "$test" || exit 1 +HOME=$(pwd) +export HOME + this_test=${0##*/} this_test=${this_test%%-*} for skp in $GIT_SKIP_TESTS -- cgit v1.2.3