Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2018-10-06 00:31:27 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-07 02:55:00 +0300
commitbc5975d24f33c974d53b3d94c5697fadaec5b000 (patch)
treebb60b346cb8f5a20ee28d0bc2c9478939b72ac26 /t/t6112-rev-list-filters-objects.sh
parentcc0b05a4cc54c30a5355a9da5d76b1879d960628 (diff)
list-objects-filter: implement filter tree:0
Teach list-objects the "tree:0" filter which allows for filtering out all tree and blob objects (unless other objects are explicitly specified by the user). The purpose of this patch is to allow smaller partial clones. The name of this filter - tree:0 - does not explicitly specify that it also filters out all blobs, but this should not cause much confusion because blobs are not at all useful without the trees that refer to them. I also considered only:commits as a name, but this is inaccurate because it suggests that annotated tags are omitted, but actually they are included. The name "tree:0" allows later filtering based on depth, i.e. "tree:1" would filter out all but the root tree and blobs. In order to avoid confusion between 0 and capital O, the documentation was worded in a somewhat round-about way that also hints at this future improvement to the feature. 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-xt/t6112-rev-list-filters-objects.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh
index 0d4d43894b..2cbb81d3bb 100755
--- a/t/t6112-rev-list-filters-objects.sh
+++ b/t/t6112-rev-list-filters-objects.sh
@@ -230,6 +230,21 @@ test_expect_success 'rev-list W/ --missing=print and --missing=allow-any for tre
test_must_be_empty rev_list_err
'
+# Test tree:0 filter.
+
+test_expect_success 'verify tree:0 includes trees in "filtered" output' '
+ git -C r3 rev-list --quiet --objects --filter-print-omitted \
+ --filter=tree:0 HEAD >revs &&
+
+ awk -f print_1.awk revs |
+ sed s/~// |
+ xargs -n1 git -C r3 cat-file -t >unsorted_filtered_types &&
+
+ sort -u unsorted_filtered_types >filtered_types &&
+ printf "blob\ntree\n" >expected &&
+ test_cmp expected filtered_types
+'
+
# Delete some loose objects and use rev-list, but WITHOUT any filtering.
# This models previously omitted objects that we did not receive.