git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v6 08/16] t4216: test changed path filters with high bit paths

From
Taylor Blau <me@ttaylorr.com>
Date
Jan 31, 2024, 22:52 UTC
Message-ID
<7de7b89da072513c6e095fccdcac92dae7cda14a.1706741516.git.me@ttaylorr.com>
In-Reply-To
<cover.1706741516.git.me@ttaylorr.com>

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 <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 t/t4216-log-bloom.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
index 64737b6ee9..93b8d096cf 100755
--- a/t/t4216-log-bloom.sh
+++ b/t/t4216-log-bloom.sh
@@ -485,6 +485,57 @@ test_expect_success 'merge graph layers with incompatible Bloom settings' '
 	test_must_be_empty err
 '
 
+get_first_changed_path_filter () {
+	test-tool read-graph bloom-filters >filters.dat &&
+	head -n 1 filters.dat
+}
+
+# chosen to be the same under all Unicode normalization forms
+CENT=$(printf "\302\242")
+
+test_expect_success 'set up repo with high bit path, version 1 changed-path' '
+	git init highbit1 &&
+	test_commit -C highbit1 c1 "$CENT" &&
+	git -C highbit1 commit-graph write --reachable --changed-paths
+'
+
+test_expect_success 'setup check value of version 1 changed-path' '
+	(
+		cd highbit1 &&
+		echo "52a9" >expect &&
+		get_first_changed_path_filter >actual
+	)
+'
+
+# expect will not match actual if char is unsigned by default. Write the test
+# in this way, so that a user running this test script can still see if the two
+# files match. (It will appear as an ordinary success if they match, and a skip
+# if not.)
+if test_cmp highbit1/expect highbit1/actual
+then
+	test_set_prereq SIGNED_CHAR_BY_DEFAULT
+fi
+test_expect_success SIGNED_CHAR_BY_DEFAULT 'check value of version 1 changed-path' '
+	# Only the prereq matters for this test.
+	true
+'
+
+test_expect_success 'setup make another commit' '
+	# "git log" does not use Bloom filters for root commits - see how, in
+	# revision.c, rev_compare_tree() (the only code path that eventually calls
+	# get_bloom_filter()) is only called by try_to_simplify_commit() when the commit
+	# has one parent. Therefore, make another commit so that we perform the tests on
+	# a non-root commit.
+	test_commit -C highbit1 anotherc1 "another$CENT"
+'
+
+test_expect_success 'version 1 changed-path used when version 1 requested' '
+	(
+		cd highbit1 &&
+		test_bloom_filters_used "-- another$CENT"
+	)
+'
+
 corrupt_graph () {
 	test_when_finished "rm -rf $graph" &&
 	git commit-graph write --reachable --changed-paths &&
-- 
2.43.0.509.g253f65a7fc
Previous: Taylor BlauNext: Taylor Blau
Message 9 of 36 in “bloom: changed-path Bloom filters v2 (& sundries)”
  1. 00/16 bloom: changed-path Bloom filters v2 (& sundries)Taylor Blau, Jan 31, 2024
  2. 01/16 t/t4216-log-bloom.sh: harden `test_bloom_filters_not_used()`Taylor Blau, Jan 31, 2024
  3. 02/16 revision.c: consult Bloom filters for root commitsTaylor Blau, Jan 31, 2024
  4. 03/16 commit-graph: ensure Bloom filters are read with consistent settingsTaylor Blau, Jan 31, 2024
  5. 04/16 gitformat-commit-graph: describe version 2 of BDATTaylor Blau, Jan 31, 2024
  6. 05/16 t/helper/test-read-graph.c: extract `dump_graph_info()`Taylor Blau, Jan 31, 2024
  7. 06/16 bloom.h: make `load_bloom_filter_from_graph()` publicTaylor Blau, Jan 31, 2024
  8. 07/16 t/helper/test-read-graph: implement `bloom-filters` modeTaylor Blau, Jan 31, 2024
  9. 08/16 t4216: test changed path filters with high bit pathsTaylor Blau, Jan 31, 2024
  10. 09/16 repo-settings: introduce commitgraph.changedPathsVersionTaylor Blau, Jan 31, 2024
  11. 10/16 bloom: annotate filters with hash versionTaylor Blau, Jan 31, 2024
  12. 11/16 bloom: prepare to discard incompatible Bloom filtersTaylor Blau, Jan 31, 2024
  13. 12/16 commit-graph: unconditionally load Bloom filtersTaylor Blau, Jan 31, 2024
  14. 13/16 commit-graph: new Bloom filter version that fixes murmur3Taylor Blau, Jan 31, 2024
  15. SZEDER GáborFeb 25, 2024
  16. Jiang XinFeb 28, 2024
  17. 14/16 object.h: fix mis-aligned flag bits tableTaylor Blau, Jan 31, 2024
  18. 15/16 commit-graph: reuse existing Bloom filters where possibleTaylor Blau, Jan 31, 2024
  19. 16/16 bloom: introduce `deinit_bloom_filters()`Taylor Blau, Jan 31, 2024
  20. 00/16 bloom: changed-path Bloom filters v2 (& sundries)Taylor Blau, Jun 25, 2024
  21. 01/16 t/t4216-log-bloom.sh: harden `test_bloom_filters_not_used()`Taylor Blau, Jun 25, 2024
  22. 02/16 revision.c: consult Bloom filters for root commitsTaylor Blau, Jun 25, 2024
  23. 03/16 commit-graph: ensure Bloom filters are read with consistent settingsTaylor Blau, Jun 25, 2024
  24. 04/16 gitformat-commit-graph: describe version 2 of BDATTaylor Blau, Jun 25, 2024
  25. 05/16 t/helper/test-read-graph.c: extract `dump_graph_info()`Taylor Blau, Jun 25, 2024
  26. 06/16 bloom.h: make `load_bloom_filter_from_graph()` publicTaylor Blau, Jun 25, 2024
  27. 07/16 t/helper/test-read-graph: implement `bloom-filters` modeTaylor Blau, Jun 25, 2024
  28. 08/16 t4216: test changed path filters with high bit pathsTaylor Blau, Jun 25, 2024
  29. 09/16 repo-settings: introduce commitgraph.changedPathsVersionTaylor Blau, Jun 25, 2024
  30. 10/16 bloom: annotate filters with hash versionTaylor Blau, Jun 25, 2024
  31. 11/16 bloom: prepare to discard incompatible Bloom filtersTaylor Blau, Jun 25, 2024
  32. 12/16 commit-graph: unconditionally load Bloom filtersTaylor Blau, Jun 25, 2024
  33. 13/16 commit-graph: new Bloom filter version that fixes murmur3Taylor Blau, Jun 25, 2024
  34. 14/16 object.h: fix mis-aligned flag bits tableTaylor Blau, Jun 25, 2024
  35. 15/16 commit-graph: reuse existing Bloom filters where possibleTaylor Blau, Jun 25, 2024
  36. 16/16 bloom: introduce `deinit_bloom_filters()`Taylor Blau, Jun 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.