Skip to content

Commit 5a6b9c8

Browse files
pks-tgitster
authored andcommitted
t/perf: fix benchmarks with alternate repo formats
Many of our benchmarks operate on a user-defined repository that we copy over before running the benchmarked logic. To keep unintentional side effects caused by on-disk state at bay we skip copying some files. This includes for example hooks, but also the repo's configuration. It is quite sensible to not copy over the configuration, as it is quite easy to inadvertently carry over configuration that may significantly impact the performance measurements. But we cannot fully ignore the configuration either, as it may contain information about the repository format. This will cause failures when for example using a repository with SHA256 object format or the reftable ref format. Fix the issue by parsing the reference and object formats from the source repository and passing them to git-init(1). Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f65182a commit 5a6b9c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

t/perf/perf-lib.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ test_perf_create_repo_from () {
9898
source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-dir)"
9999
objects_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-path objects)"
100100
common_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-common-dir)"
101+
refformat="$("$MODERN_GIT" -C "$source" rev-parse --show-ref-format)"
102+
objectformat="$("$MODERN_GIT" -C "$source" rev-parse --show-object-format)"
101103
mkdir -p "$repo/.git"
102104
(
103105
cd "$source" &&
@@ -114,7 +116,7 @@ test_perf_create_repo_from () {
114116
) &&
115117
(
116118
cd "$repo" &&
117-
"$MODERN_GIT" init -q &&
119+
"$MODERN_GIT" init -q --ref-format="$refformat" --object-format="$objectformat" &&
118120
test_perf_do_repo_symlink_config_ &&
119121
mv .git/hooks .git/hooks-disabled 2>/dev/null &&
120122
if test -f .git/index.lock

0 commit comments

Comments
 (0)