Skip to content

Commit e8d5a42

Browse files
committed
Merge branch 'jk/perf-in-worktrees'
Perf test update to work better in secondary worktrees. * jk/perf-in-worktrees: t/perf: avoid copying worktree files from test repo t/perf: handle worktrees as test repos
2 parents d20fa3c + 36e834a commit e8d5a42

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

t/perf/perf-lib.sh

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,40 @@ test_perf_do_repo_symlink_config_ () {
7070
test_have_prereq SYMLINKS || git config core.symlinks false
7171
}
7272

73+
test_perf_copy_repo_contents () {
74+
for stuff in "$1"/*
75+
do
76+
case "$stuff" in
77+
*/objects|*/hooks|*/config|*/commondir|*/gitdir|*/worktrees)
78+
;;
79+
*)
80+
cp -R "$stuff" "$repo/.git/" || exit 1
81+
;;
82+
esac
83+
done
84+
}
85+
7386
test_perf_create_repo_from () {
7487
test "$#" = 2 ||
7588
BUG "not 2 parameters to test-create-repo"
7689
repo="$1"
7790
source="$2"
7891
source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-dir)"
7992
objects_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-path objects)"
93+
common_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-common-dir)"
8094
mkdir -p "$repo/.git"
8195
(
8296
cd "$source" &&
8397
{ cp -Rl "$objects_dir" "$repo/.git/" 2>/dev/null ||
8498
cp -R "$objects_dir" "$repo/.git/"; } &&
85-
for stuff in "$source_git"/*; do
86-
case "$stuff" in
87-
*/objects|*/hooks|*/config|*/commondir)
88-
;;
89-
*)
90-
cp -R "$stuff" "$repo/.git/" || exit 1
91-
;;
92-
esac
93-
done
99+
100+
# common_dir must come first here, since we want source_git to
101+
# take precedence and overwrite any overlapping files
102+
test_perf_copy_repo_contents "$common_dir"
103+
if test "$source_git" != "$common_dir"
104+
then
105+
test_perf_copy_repo_contents "$source_git"
106+
fi
94107
) &&
95108
(
96109
cd "$repo" &&

0 commit comments

Comments
 (0)