diff options
| author | Matthew DeVore <matvore@google.com> | 2018-10-17 17:39:15 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-10-18 12:49:18 +0900 |
| commit | 8b10a206f090e01ce1ac4d9a10ec769e2409e2b0 (patch) | |
| tree | 13308fe2d78d914e6e5548d144c4368b5980c471 /t/t6112-rev-list-filters-objects.sh | |
| parent | filter-trees: code clean-up of tests (diff) | |
| download | git-8b10a206f090e01ce1ac4d9a10ec769e2409e2b0.tar.gz git-8b10a206f090e01ce1ac4d9a10ec769e2409e2b0.zip | |
list-objects: support for skipping tree traversal
The tree:0 filter does not need to traverse the trees that it has
filtered out, so optimize list-objects and list-objects-filter to skip
traversing the trees entirely. Before this patch, we iterated over all
children of the tree, and did nothing for all of them, which was
wasteful.
Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6112-rev-list-filters-objects.sh')
| -rwxr-xr-x | t/t6112-rev-list-filters-objects.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh index d24f9d5b5a..c6aae93b57 100755 --- a/t/t6112-rev-list-filters-objects.sh +++ b/t/t6112-rev-list-filters-objects.sh @@ -245,6 +245,19 @@ test_expect_success 'verify tree:0 includes trees in "filtered" output' ' test_cmp expected filtered_types ' +# Make sure tree:0 does not iterate through any trees. + +test_expect_success 'filter a GIANT tree through tree:0' ' + GIT_TRACE=1 git -C r3 rev-list \ + --objects --filter=tree:0 HEAD 2>filter_trace && + grep "Skipping contents of tree [.][.][.]" filter_trace >actual && + # One line for each commit traversed. + test_line_count = 2 actual && + + # Make sure no other trees were considered besides the root. + ! grep "Skipping contents of tree [^.]" filter_trace +' + # Delete some loose objects and use rev-list, but WITHOUT any filtering. # This models previously omitted objects that we did not receive. |
