Skip to content

Commit 08b6ae3

Browse files
ttaylorrgitster
authored andcommitted
t4216: test changed path filters with high bit paths
Subsequent commits will teach Git another version of changed path filter that has different behavior with paths that contain at least one character with its high bit set, so test the existing behavior as a baseline. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 57982b8 commit 08b6ae3

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

t/t4216-log-bloom.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,57 @@ test_expect_success 'merge graph layers with incompatible Bloom settings' '
488488
test_must_be_empty err
489489
'
490490

491+
get_first_changed_path_filter () {
492+
test-tool read-graph bloom-filters >filters.dat &&
493+
head -n 1 filters.dat
494+
}
495+
496+
# chosen to be the same under all Unicode normalization forms
497+
CENT=$(printf "\302\242")
498+
499+
test_expect_success 'set up repo with high bit path, version 1 changed-path' '
500+
git init highbit1 &&
501+
test_commit -C highbit1 c1 "$CENT" &&
502+
git -C highbit1 commit-graph write --reachable --changed-paths
503+
'
504+
505+
test_expect_success 'setup check value of version 1 changed-path' '
506+
(
507+
cd highbit1 &&
508+
echo "52a9" >expect &&
509+
get_first_changed_path_filter >actual
510+
)
511+
'
512+
513+
# expect will not match actual if char is unsigned by default. Write the test
514+
# in this way, so that a user running this test script can still see if the two
515+
# files match. (It will appear as an ordinary success if they match, and a skip
516+
# if not.)
517+
if test_cmp highbit1/expect highbit1/actual
518+
then
519+
test_set_prereq SIGNED_CHAR_BY_DEFAULT
520+
fi
521+
test_expect_success SIGNED_CHAR_BY_DEFAULT 'check value of version 1 changed-path' '
522+
# Only the prereq matters for this test.
523+
true
524+
'
525+
526+
test_expect_success 'setup make another commit' '
527+
# "git log" does not use Bloom filters for root commits - see how, in
528+
# revision.c, rev_compare_tree() (the only code path that eventually calls
529+
# get_bloom_filter()) is only called by try_to_simplify_commit() when the commit
530+
# has one parent. Therefore, make another commit so that we perform the tests on
531+
# a non-root commit.
532+
test_commit -C highbit1 anotherc1 "another$CENT"
533+
'
534+
535+
test_expect_success 'version 1 changed-path used when version 1 requested' '
536+
(
537+
cd highbit1 &&
538+
test_bloom_filters_used "-- another$CENT"
539+
)
540+
'
541+
491542
corrupt_graph () {
492543
test_when_finished "rm -rf $graph" &&
493544
git commit-graph write --reachable --changed-paths &&

0 commit comments

Comments
 (0)