p2000: add 'git checkout -' test and decrease depth
As we increase our list of commands to test in p2000-sparse-operations.sh, we will want to have a slightly smaller test repository. Reduce the size by a factor of four by reducing the depth of the step that creates a big index around a moderately-sized repository. Also add a step to run 'git checkout -' on repeat. This requires having a previous location in the reflog, so add that to the initialization steps. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Jun 29, 2021 at 02:13 UTC
0d53d1994670ce43964a34bdf1f68d26188bafc8
1 file changed
+20
-7
t/perf/p2000-sparse-operations.sh
+20
-7
@@ -6,7 +6,7 @@ test_description="test performance of Git operations using the index"
6
7
test_perf_default_repo
8
9
-SPARSE_CONE=f2/f4/f1
9
+SPARSE_CONE=f2/f4
10
11
test_expect_success 'setup repo and indexes' '
12
git reset --hard HEAD &&
@@ -27,7 +27,7 @@ test_expect_success 'setup repo and indexes' '
27
OLD_COMMIT=$(git rev-parse HEAD) &&
28
OLD_TREE=$(git rev-parse HEAD^{tree}) &&
29
30
- for i in $(test_seq 1 4)
30
+ for i in $(test_seq 1 3)
31
do
32
cat >in <<-EOF &&
33
100755 blob $BLOB a
@@ -43,14 +43,23 @@ test_expect_success 'setup repo and indexes' '
43
done &&
44
45
git sparse-checkout init --cone &&
46
- git branch -f wide $OLD_COMMIT &&
46
+ git sparse-checkout set $SPARSE_CONE &&
47
+ git checkout -b wide $OLD_COMMIT &&
48
+
49
+ for l2 in f1 f2 f3 f4
50
+ do
51
+ echo more bogus >>$SPARSE_CONE/$l2/a &&
52
+ git commit -a -m "edit $SPARSE_CONE/$l2/a" || return 1
53
+ done &&
54
+
55
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-index-v3 &&
56
(
57
cd full-index-v3 &&
58
git sparse-checkout init --cone &&
59
git sparse-checkout set $SPARSE_CONE &&
60
git config index.version 3 &&
53
- git update-index --index-version=3
61
+ git update-index --index-version=3 &&
62
+ git checkout HEAD~4
63
) &&
64
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-index-v4 &&
65
(
@@ -58,7 +67,8 @@ test_expect_success 'setup repo and indexes' '
67
git sparse-checkout init --cone &&
68
git sparse-checkout set $SPARSE_CONE &&
69
git config index.version 4 &&
61
- git update-index --index-version=4
70
+ git update-index --index-version=4 &&
71
+ git checkout HEAD~4
72
) &&
73
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-index-v3 &&
74
(
@@ -66,7 +76,8 @@ test_expect_success 'setup repo and indexes' '
76
git sparse-checkout init --cone --sparse-index &&
77
git sparse-checkout set $SPARSE_CONE &&
78
git config index.version 3 &&
69
- git update-index --index-version=3
79
+ git update-index --index-version=3 &&
80
+ git checkout HEAD~4
81
) &&
82
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-index-v4 &&
83
(
@@ -74,7 +85,8 @@ test_expect_success 'setup repo and indexes' '
85
git sparse-checkout init --cone --sparse-index &&
86
git sparse-checkout set $SPARSE_CONE &&
87
git config index.version 4 &&
77
- git update-index --index-version=4
88
+ git update-index --index-version=4 &&
89
+ git checkout HEAD~4
90
)
91
'
92
@@ -97,5 +109,6 @@ test_perf_on_all git status
109
test_perf_on_all git add -A
110
test_perf_on_all git add .
111
test_perf_on_all git commit -a -m A
112
+test_perf_on_all git checkout -f -
113
114
test_done