Repository navigation
Conversation
Build two trees from the input, the second one from the first one with some changes, and diff them with flags, pathspecs and a notify callback from the input. Compare the deltas with the deltas of the same diff with GIT_DIFF_INCLUDE_UNMODIFIED, which reads every subtree, without the unmodified deltas.
Diff a tree of 32768 files with itself and with a tree where one file changed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a fuzzer and a benchmark for
git_diff_tree_to_tree. I wrote them while working on #6863.The fuzzer (
fuzzers/diff_tree_fuzzer.c) builds two trees from the input. The second tree is derived from the first one, so they share subtrees. It diffs them with flags, pathspecs and a notify callback taken from the input, and checks the result against the same diff withGIT_DIFF_INCLUDE_UNMODIFIED, ignoring the unmodified deltas. That option forces every subtree to be read, so this checks that skipping unmodified trees (#6863) doesn't change anything. Objects are kept in a mempack backend that's reset after each input.It found bugs pretty quickly. On main it hits #7392 in 2 out of 3 two-minute runs. On the first version of #6863 it found a difference in each of 6 runs of 90 seconds.
The corpus has those 6 inputs plus a minimized set from a longer run. I left out the input for #7392, so the standalone run passes on main until that's fixed.
The benchmark (
benchmarks/libgit2/diff.c) diffs a tree with 32768 files (32 × 32 directories with 32 files each) against itself and against a copy with one changed file. RelWithDebInfo: