diff options
author | Matthew DeVore <matvore@google.com> | 2018-10-18 03:39:15 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-18 06:49:18 +0300 |
commit | 8b10a206f090e01ce1ac4d9a10ec769e2409e2b0 (patch) | |
tree | 13308fe2d78d914e6e5548d144c4368b5980c471 /t/t6112-rev-list-filters-objects.sh | |
parent | d9e6d0942bb9f9fe9e4cca9670181e5b59074bcb (diff) |
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. |