Subject: [PATCH v3 0/4] Changed path filter hash fix and version bump

From: Jonathan Tan <[email-masked]>
Date: Thu, 8 Jun 2023 12:21:21 -0700

Here's an updated version with changes only in the tests:
 - resilience against unsigned-by-default (a "skip" will be shown)
 - for systems that have different quoting behavior, the tests
   will be skipped (see patch 2 for more information)

Some of the test changes may seem a bit of a hack, so if you have
a better way of doing things, please let me know.

I've also included a change to the file format specification. To
reviewers, if you generally agree that we need a version 2 but are still
unsure about how we should migrate, consider saying so and then perhaps
we can merge the first patch while the rest remain under review. This
will give other projects, like JGit, more certainty as to the direction
that the Git project wants to take.

Jonathan Tan (4):
  gitformat-commit-graph: describe version 2 of BDAT
  t4216: test changed path filters with high bit paths
  repo-settings: introduce commitgraph.changedPathsVersion
  commit-graph: new filter ver. that fixes murmur3

 Documentation/config/commitgraph.txt     | 16 ++++-
 Documentation/gitformat-commit-graph.txt |  9 ++-
 bloom.c                                  | 65 +++++++++++++++++-
 bloom.h                                  |  8 ++-
 commit-graph.c                           | 29 ++++++--
 oss-fuzz/fuzz-commit-graph.c             |  2 +-
 repo-settings.c                          |  6 +-
 repository.h                             |  2 +-
 t/helper/test-bloom.c                    |  9 ++-
 t/t0095-bloom.sh                         |  8 +++
 t/t4216-log-bloom.sh                     | 86 ++++++++++++++++++++++++
 11 files changed, 219 insertions(+), 21 deletions(-)

Range-diff against v2:
-:  ---------- > 1:  d4b63945f6 gitformat-commit-graph: describe version 2 of BDAT
1:  c587eb3470 ! 2:  aa4535776e t4216: test changed path filters with high bit paths
    @@ t/t4216-log-bloom.sh: test_expect_success 'Bloom generation backfills empty comm
     +# chosen to be the same under all Unicode normalization forms
     +CENT=$(printf "\xc2\xa2")
     +
    -+test_expect_success 'set up repo with high bit path, version 1 changed-path' '
    ++# Some systems (in particular, Linux on the CI running on GitHub at the time of
    ++# writing) store into CENT a literal backslash, then "x", and so on (instead of
    ++# the high-bit characters needed). In these systems, do not run the following
    ++# tests.
    ++if test "$(printf $CENT | perl -0777 -ne 'no utf8; print ord($_)')" = "194"
    ++then
    ++	test_set_prereq HIGH_BIT
    ++fi
    ++
    ++test_expect_success HIGH_BIT '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 'check value of version 1 changed-path' '
    ++test_expect_success HIGH_BIT 'setup check value of version 1 changed-path' '
     +	(cd highbit1 &&
     +		printf "52a9" >expect &&
    -+		get_first_changed_path_filter >actual &&
    -+		test_cmp expect actual)
    ++		get_first_changed_path_filter >actual)
    ++'
    ++
    ++# expect will not match actual if int 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_INT_BY_DEFAULT
    ++fi
    ++test_expect_success SIGNED_INT_BY_DEFAULT 'check value of version 1 changed-path' '
    ++	# Only the prereq matters for this test.
    ++	true
     +'
     +
    -+test_expect_success 'version 1 changed-path used when version 1 requested' '
    ++test_expect_success HIGH_BIT 'version 1 changed-path used when version 1 requested' '
     +	(cd highbit1 &&
     +		test_bloom_filters_used "-- $CENT")
     +'
2:  d0e5dd20dc = 3:  d6982268a4 repo-settings: introduce commitgraph.changedPathsVersion
3:  eb19f8a35b ! 4:  e879483c42 commit-graph: new filter ver. that fixes murmur3
    @@ t/t0095-bloom.sh: test_expect_success 'compute unseeded murmur3 hash for test st
      	Hashes:0x5615800c|0x5b966560|0x61174ab4|0x66983008|0x6c19155c|0x7199fab0|0x771ae004|
     
      ## t/t4216-log-bloom.sh ##
    -@@ t/t4216-log-bloom.sh: test_expect_success 'version 1 changed-path used when version 1 requested' '
    +@@ t/t4216-log-bloom.sh: test_expect_success HIGH_BIT 'version 1 changed-path used when version 1 request
      		test_bloom_filters_used "-- $CENT")
      '
      
    -+test_expect_success 'version 1 changed-path not used when version 2 requested' '
    ++test_expect_success HIGH_BIT 'version 1 changed-path not used when version 2 requested' '
     +	(cd highbit1 &&
     +		git config --add commitgraph.changedPathsVersion 2 &&
     +		test_bloom_filters_not_used "-- $CENT")
     +'
     +
    -+test_expect_success 'set up repo with high bit path, version 2 changed-path' '
    ++test_expect_success HIGH_BIT 'set up repo with high bit path, version 2 changed-path' '
     +	git init highbit2 &&
     +	git -C highbit2 config --add commitgraph.changedPathsVersion 2 &&
     +	test_commit -C highbit2 c2 "$CENT" &&
     +	git -C highbit2 commit-graph write --reachable --changed-paths
     +'
     +
    -+test_expect_success 'check value of version 2 changed-path' '
    ++test_expect_success HIGH_BIT 'check value of version 2 changed-path' '
     +	(cd highbit2 &&
     +		printf "c01f" >expect &&
     +		get_first_changed_path_filter >actual &&
     +		test_cmp expect actual)
     +'
     +
    -+test_expect_success 'version 2 changed-path used when version 2 requested' '
    ++test_expect_success HIGH_BIT 'version 2 changed-path used when version 2 requested' '
     +	(cd highbit2 &&
     +		test_bloom_filters_used "-- $CENT")
     +'
     +
    -+test_expect_success 'version 2 changed-path not used when version 1 requested' '
    ++test_expect_success HIGH_BIT 'version 2 changed-path not used when version 1 requested' '
     +	(cd highbit2 &&
     +		git config --add commitgraph.changedPathsVersion 1 &&
     +		test_bloom_filters_not_used "-- $CENT")
-- 
2.41.0.162.gfafddb0af9-goog