Skip to content

Commit 7b02771

Browse files
committed
Merge branch 'js/perf-rebase-i'
Add perf test for "rebase -i" * js/perf-rebase-i: perf: run "rebase -i" under perf perf: make the tests work in worktrees perf: let's disable symlinks when they are not available
2 parents 2997ea9 + e4cfe74 commit 7b02771

File tree

2 files changed

+47
-8
lines changed

2 files changed

+47
-8
lines changed

t/perf/p3404-rebase-interactive.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
test_description='Tests rebase -i performance'
4+
. ./perf-lib.sh
5+
6+
test_perf_default_repo
7+
8+
# This commit merges a sufficiently long topic branch for reasonable
9+
# performance testing
10+
branch_merge=ba5312da19c6fdb6c6747d479f58932aae6e900c^{commit}
11+
export branch_merge
12+
13+
git rev-parse --verify $branch_merge >/dev/null 2>&1 || {
14+
skip_all='skipping because $branch_merge was not found'
15+
test_done
16+
}
17+
18+
write_script swap-first-two.sh <<\EOF
19+
case "$1" in
20+
*/COMMIT_EDITMSG)
21+
mv "$1" "$1".bak &&
22+
sed -e '1{h;d}' -e 2G <"$1".bak >"$1"
23+
;;
24+
esac
25+
EOF
26+
27+
test_expect_success 'setup' '
28+
git config core.editor "\"$PWD"/swap-first-two.sh\" &&
29+
git checkout -f $branch_merge^2
30+
'
31+
32+
test_perf 'rebase -i' '
33+
git rebase -i $branch_merge^
34+
'
35+
36+
test_done

t/perf/perf-lib.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,26 @@ test_perf_create_repo_from () {
8080
error "bug in the test script: not 2 parameters to test-create-repo"
8181
repo="$1"
8282
source="$2"
83-
source_git=$source/$(cd "$source" && git rev-parse --git-dir)
83+
source_git="$(git -C "$source" rev-parse --git-dir)"
84+
objects_dir="$(git -C "$source" rev-parse --git-path objects)"
8485
mkdir -p "$repo/.git"
8586
(
86-
cd "$repo/.git" &&
87-
{ cp -Rl "$source_git/objects" . 2>/dev/null ||
88-
cp -R "$source_git/objects" .; } &&
87+
{ cp -Rl "$objects_dir" "$repo/.git/" 2>/dev/null ||
88+
cp -R "$objects_dir" "$repo/.git/"; } &&
8989
for stuff in "$source_git"/*; do
9090
case "$stuff" in
91-
*/objects|*/hooks|*/config)
91+
*/objects|*/hooks|*/config|*/commondir)
9292
;;
9393
*)
94-
cp -R "$stuff" . || exit 1
94+
cp -R "$stuff" "$repo/.git/" || exit 1
9595
;;
9696
esac
9797
done &&
98-
cd .. &&
99-
git init -q &&
98+
cd "$repo" &&
99+
git init -q && {
100+
test_have_prereq SYMLINKS ||
101+
git config core.symlinks false
102+
} &&
100103
mv .git/hooks .git/hooks-disabled 2>/dev/null
101104
) || error "failed to copy repository '$source' to '$repo'"
102105
}

0 commit comments

Comments
 (0)