diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-10-30 06:43:39 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-30 06:43:39 (GMT) |
commit | 77d503757d6328703f9571a4432dd83800bc26bb (patch) | |
tree | 55b106aab90b9b44a8d8e7cc38af63f2a3e743b9 /t/t5317-pack-objects-filter-objects.sh | |
parent | c670b1f876521c9f7cd40184bf7ed05aad843433 (diff) | |
parent | 8b10a206f090e01ce1ac4d9a10ec769e2409e2b0 (diff) | |
download | git-77d503757d6328703f9571a4432dd83800bc26bb.zip git-77d503757d6328703f9571a4432dd83800bc26bb.tar.gz git-77d503757d6328703f9571a4432dd83800bc26bb.tar.bz2 |
Merge branch 'md/filter-trees'
The "rev-list --filter" feature learned to exclude all trees via
"tree:0" filter.
* md/filter-trees:
list-objects: support for skipping tree traversal
filter-trees: code clean-up of tests
list-objects-filter: implement filter tree:0
list-objects-filter-options: do not over-strbuf_init
list-objects-filter: use BUG rather than die
revision: mark non-user-given objects instead
rev-list: handle missing tree objects properly
list-objects: always parse trees gently
list-objects: refactor to process_tree_contents
list-objects: store common func args in struct
Diffstat (limited to 't/t5317-pack-objects-filter-objects.sh')
-rwxr-xr-x | t/t5317-pack-objects-filter-objects.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh index 2e718f0..24541ea 100755 --- a/t/t5317-pack-objects-filter-objects.sh +++ b/t/t5317-pack-objects-filter-objects.sh @@ -67,6 +67,47 @@ test_expect_success 'verify normal and blob:none packfiles have same commits/tre test_cmp expected observed ' +test_expect_success 'get an error for missing tree object' ' + git init r5 && + echo foo >r5/foo && + git -C r5 add foo && + git -C r5 commit -m "foo" && + del=$(git -C r5 rev-parse HEAD^{tree} | sed "s|..|&/|") && + rm r5/.git/objects/$del && + test_must_fail git -C r5 pack-objects --rev --stdout 2>bad_tree <<-EOF && + HEAD + EOF + grep "bad tree object" bad_tree +' + +test_expect_success 'setup for tests of tree:0' ' + mkdir r1/subtree && + echo "This is a file in a subtree" >r1/subtree/file && + git -C r1 add subtree/file && + git -C r1 commit -m subtree +' + +test_expect_success 'verify tree:0 packfile has no blobs or trees' ' + git -C r1 pack-objects --rev --stdout --filter=tree:0 >commitsonly.pack <<-EOF && + HEAD + EOF + git -C r1 index-pack ../commitsonly.pack && + git -C r1 verify-pack -v ../commitsonly.pack >objs && + ! grep -E "tree|blob" objs +' + +test_expect_success 'grab tree directly when using tree:0' ' + # We should get the tree specified directly but not its blobs or subtrees. + git -C r1 pack-objects --rev --stdout --filter=tree:0 >commitsonly.pack <<-EOF && + HEAD: + EOF + git -C r1 index-pack ../commitsonly.pack && + git -C r1 verify-pack -v ../commitsonly.pack >objs && + awk "/tree|blob/{print \$1}" objs >trees_and_blobs && + git -C r1 rev-parse HEAD: >expected && + test_cmp expected trees_and_blobs +' + # Test blob:limit=<n>[kmg] filter. # We boundary test around the size parameter. The filter is strictly less than # the value, so size 500 and 1000 should have the same results, but 1001 should |