Skip to content

Commit 6a3c66d

Browse files
committed
Merge branch 'ty/perf-3400-optim'
Improve set-up time of a perf test. * ty/perf-3400-optim: t/perf/p3400: speed up setup using fast-import
2 parents 35e17b2 + 8466efa commit 6a3c66d

1 file changed

Lines changed: 38 additions & 15 deletions

File tree

t/perf/p3400-rebase.sh

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,44 @@ test_expect_success 'setup rebasing on top of a lot of changes' '
99
git checkout -f -B base &&
1010
git checkout -B to-rebase &&
1111
git checkout -B upstream &&
12-
for i in $(test_seq 100)
13-
do
14-
# simulate huge diffs
15-
echo change$i >unrelated-file$i &&
16-
test_seq 1000 >>unrelated-file$i &&
17-
git add unrelated-file$i &&
18-
test_tick &&
19-
git commit -m commit$i unrelated-file$i &&
20-
echo change$i >unrelated-file$i &&
21-
test_seq 1000 | sort -nr >>unrelated-file$i &&
22-
git add unrelated-file$i &&
23-
test_tick &&
24-
git commit -m commit$i-reverse unrelated-file$i ||
25-
return 1
26-
done &&
12+
test_seq 1000 >content_fwd &&
13+
sort -nr content_fwd >content_rev &&
14+
(
15+
for i in $(test_seq 100)
16+
do
17+
test_tick &&
18+
echo "commit refs/heads/upstream" &&
19+
echo "committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
20+
echo "data <<EOF" &&
21+
echo "commit$i" &&
22+
echo "EOF" &&
23+
24+
if test "$i" = 1; then
25+
echo "from refs/heads/upstream^0"
26+
fi &&
27+
28+
echo "M 100644 inline unrelated-file$i" &&
29+
echo "data <<EOF" &&
30+
echo "change$i" &&
31+
cat content_fwd &&
32+
echo "EOF" &&
33+
34+
echo "commit refs/heads/upstream" &&
35+
echo "committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" &&
36+
echo "data <<EOF" &&
37+
echo "commit$i-reverse" &&
38+
echo "EOF" &&
39+
echo "M 100644 inline unrelated-file$i" &&
40+
echo "data <<EOF" &&
41+
echo "change$i" &&
42+
cat content_rev &&
43+
echo "EOF" || exit 1
44+
done
45+
) >fast_import_stream &&
46+
47+
git fast-import <fast_import_stream &&
48+
git repack -a -d &&
49+
git checkout -f upstream &&
2750
git checkout to-rebase &&
2851
test_commit our-patch interesting-file
2952
'

0 commit comments

Comments
 (0)