Revision 65c1a28bb60d1c17a672306c651bb402378f81b0 authored by Derrick Stolee on 11 May 2020, 11:56:12 UTC, committed by Junio C Hamano on 11 May 2020, 16:33:56 UTC
When computing a changed-path Bloom filter, we need to take the files that changed from the diff computation and extract the parent directories. That way, a directory pathspec such as "Documentation" could match commits that change "Documentation/git.txt". However, the current code does a poor job of this process. The paths are added to a hashmap, but we do not check if an entry already exists with that path. This can create many duplicate entries and cause the filter to have a much larger length than it should. This means that the filter is more sparse than intended, which helps the false positive rate, but wastes a lot of space. Properly use hashmap_get() before hashmap_add(). Also be sure to include a comparison function so these can be matched correctly. This has an effect on a test in t0095-bloom.sh. This makes sense, there are ten changes inside "smallDir" so the total number of paths in the filter should be 11. This would result in 11 * 10 bits required, and with 8 bits per byte, this results in 14 bytes. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8809328
File | Mode | Size |
---|---|---|
FromCPAN | ||
Git | ||
header_templates | ||
.gitignore | -rw-r--r-- | 8 bytes |
Git.pm | -rw-r--r-- | 45.8 KB |
Computing file changes ...