perf: make the tests work without a worktree
authorRené Scharfe <l.s.r@web.de>
Sun, 29 May 2016 16:43:41 +0000 (18:43 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 May 2016 20:44:59 +0000 (13:44 -0700)
In regular repositories $source_git and $objects_dir contain relative
paths based on $source. Go there to allow cp to resolve them.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/perf-lib.sh
index 5ef17440c0e1e63102adddba958686c28b4e80ec..18c363ea7f384ee625b0efc162dc081f51a3780f 100644 (file)
@@ -84,6 +84,7 @@ test_perf_create_repo_from () {
        objects_dir="$(git -C "$source" rev-parse --git-path objects)"
        mkdir -p "$repo/.git"
        (
+               cd "$source" &&
                { cp -Rl "$objects_dir" "$repo/.git/" 2>/dev/null ||
                        cp -R "$objects_dir" "$repo/.git/"; } &&
                for stuff in "$source_git"/*; do
@@ -94,7 +95,9 @@ test_perf_create_repo_from () {
                                        cp -R "$stuff" "$repo/.git/" || exit 1
                                        ;;
                        esac
-               done &&
+               done
+       ) &&
+       (
                cd "$repo" &&
                git init -q && {
                        test_have_prereq SYMLINKS ||