diff options
author | Carl Worth <cworth@cworth.org> | 2006-02-17 13:33:26 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-17 16:16:53 -0800 |
commit | eedf8f97e58bbf4717705900379f2d63134047f9 (patch) | |
tree | 11f95e25601c2ce3bf7aa93104246f8338d14ed8 /t | |
parent | 41ff7a1076e9282535f77ddfb4e23a95354009fd (diff) | |
download | git-eedf8f97e58bbf4717705900379f2d63134047f9.tar.gz git-eedf8f97e58bbf4717705900379f2d63134047f9.tar.xz |
Abstract test_create_repo out for use in tests.
Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't')
-rwxr-xr-x | t/test-lib.sh | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index 7a58a86f9..66f62b9c6 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -149,6 +149,21 @@ test_expect_code () { fi } +# Most tests can use the created repository, but some amy need to create more. +# Usage: test_create_repo <directory> +test_create_repo () { + test "$#" = 1 || + error "bug in the test script: not 1 parameter to test-create-repo" + owd=`pwd` + repo="$1" + mkdir "$repo" + cd "$repo" || error "Cannot setup test environment" + "$GIT_EXEC_PATH/git" init-db --template=$GIT_EXEC_PATH/templates/blt/ 2>/dev/null || + error "cannot run git init-db -- have you built things yet?" + mv .git/hooks .git/hooks-disabled + cd "$owd" +} + test_done () { trap - exit case "$test_failure" in @@ -196,9 +211,5 @@ test -d ../templates/blt || { # Test repository test=trash rm -fr "$test" -mkdir "$test" -cd "$test" || error "Cannot setup test environment" -"$GIT_EXEC_PATH/git" init-db --template=../../templates/blt/ 2>/dev/null || -error "cannot run git init-db -- have you built things yet?" - -mv .git/hooks .git/hooks-disabled +test_create_repo $test +cd "$test" |