Skip to content

Commit 0d53d19

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e5ca291 commit 0d53d19

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

t/perf/p2000-sparse-operations.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test_description="test performance of Git operations using the index"
66

77
test_perf_default_repo
88

9-
SPARSE_CONE=f2/f4/f1
9+
SPARSE_CONE=f2/f4
1010

1111
test_expect_success 'setup repo and indexes' '
1212
git reset --hard HEAD &&
@@ -27,7 +27,7 @@ test_expect_success 'setup repo and indexes' '
2727
OLD_COMMIT=$(git rev-parse HEAD) &&
2828
OLD_TREE=$(git rev-parse HEAD^{tree}) &&
2929
30-
for i in $(test_seq 1 4)
30+
for i in $(test_seq 1 3)
3131
do
3232
cat >in <<-EOF &&
3333
100755 blob $BLOB a
@@ -43,38 +43,50 @@ test_expect_success 'setup repo and indexes' '
4343
done &&
4444
4545
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+
4755
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-index-v3 &&
4856
(
4957
cd full-index-v3 &&
5058
git sparse-checkout init --cone &&
5159
git sparse-checkout set $SPARSE_CONE &&
5260
git config index.version 3 &&
53-
git update-index --index-version=3
61+
git update-index --index-version=3 &&
62+
git checkout HEAD~4
5463
) &&
5564
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . full-index-v4 &&
5665
(
5766
cd full-index-v4 &&
5867
git sparse-checkout init --cone &&
5968
git sparse-checkout set $SPARSE_CONE &&
6069
git config index.version 4 &&
61-
git update-index --index-version=4
70+
git update-index --index-version=4 &&
71+
git checkout HEAD~4
6272
) &&
6373
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-index-v3 &&
6474
(
6575
cd sparse-index-v3 &&
6676
git sparse-checkout init --cone --sparse-index &&
6777
git sparse-checkout set $SPARSE_CONE &&
6878
git config index.version 3 &&
69-
git update-index --index-version=3
79+
git update-index --index-version=3 &&
80+
git checkout HEAD~4
7081
) &&
7182
git -c core.sparseCheckoutCone=true clone --branch=wide --sparse . sparse-index-v4 &&
7283
(
7384
cd sparse-index-v4 &&
7485
git sparse-checkout init --cone --sparse-index &&
7586
git sparse-checkout set $SPARSE_CONE &&
7687
git config index.version 4 &&
77-
git update-index --index-version=4
88+
git update-index --index-version=4 &&
89+
git checkout HEAD~4
7890
)
7991
'
8092

@@ -97,5 +109,6 @@ test_perf_on_all git status
97109
test_perf_on_all git add -A
98110
test_perf_on_all git add .
99111
test_perf_on_all git commit -a -m A
112+
test_perf_on_all git checkout -f -
100113

101114
test_done

0 commit comments

Comments
 (0)