diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-20 21:33:52 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-20 21:33:52 +0300 |
commit | 0c54cdaf6580f121919048633e85772d60b8fb17 (patch) | |
tree | e2c0985b9c692678a0f9972047ae837b86d59879 /t | |
parent | 42a6274b62397ab0047a21729c99f8fb06193f9b (diff) | |
parent | 0889aae1cd18c1804ba01c1a4229e516dfb9fe9b (diff) |
Merge branch 'jk/for-each-object-iteration'
The API to iterate over all objects learned to optionally list
objects in the order they appear in packfiles, which helps locality
of access if the caller accesses these objects while as objects are
enumerated.
* jk/for-each-object-iteration:
for_each_*_object: move declarations to object-store.h
cat-file: use a single strbuf for all output
cat-file: split batch "buf" into two variables
cat-file: use oidset check-and-insert
cat-file: support "unordered" output for --batch-all-objects
cat-file: rename batch_{loose,packed}_object callbacks
t1006: test cat-file --batch-all-objects with duplicates
for_each_packed_object: support iterating in pack-order
for_each_*_object: give more comprehensive docstrings
for_each_*_object: take flag arguments as enum
for_each_*_object: store flag definitions in a single location
Diffstat (limited to 't')
-rwxr-xr-x | t/t1006-cat-file.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh index 13dd510b2ed..7f19d591f25 100755 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@ -550,8 +550,8 @@ test_expect_success 'git cat-file --batch --follow-symlink returns correct sha a test_expect_success 'cat-file --batch-all-objects shows all objects' ' # make new repos so we know the full set of objects; we will # also make sure that there are some packed and some loose - # objects, some referenced and some not, and that there are - # some available only via alternates. + # objects, some referenced and some not, some duplicates, and that + # there are some available only via alternates. git init all-one && ( cd all-one && @@ -567,10 +567,23 @@ test_expect_success 'cat-file --batch-all-objects shows all objects' ' cd all-two && echo local-unref | git hash-object -w --stdin ) >>expect.unsorted && + git -C all-two rev-parse HEAD:file | + git -C all-two pack-objects .git/objects/pack/pack && sort <expect.unsorted >expect && git -C all-two cat-file --batch-all-objects \ --batch-check="%(objectname)" >actual && test_cmp expect actual ' +# The only user-visible difference is that the objects are no longer sorted, +# and the resulting sort order is undefined. So we can only check that it +# produces the same objects as the ordered case, but that at least exercises +# the code. +test_expect_success 'cat-file --unordered works' ' + git -C all-two cat-file --batch-all-objects --unordered \ + --batch-check="%(objectname)" >actual.unsorted && + sort <actual.unsorted >actual && + test_cmp expect actual +' + test_done |