diff options
author | Bruno Albuquerque <bga@google.com> | 2021-04-21 02:38:31 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-21 03:41:13 +0300 |
commit | a2ba162cda2acc171c3e36acbbc854792b093cb7 (patch) | |
tree | 7e276bdd845e0291feb9aae460e074a73b7efca7 /t/t5701-git-serve.sh | |
parent | d1b10fc6d84d49796026e567833b88c7f8886c35 (diff) |
object-info: support for retrieving object info
Sometimes it is useful to get information of an object without having to
download it completely.
Add the "object-info" capability that lets the client ask for
object-related information with their full hexadecimal object names.
Only sizes are returned for now.
Signed-off-by: Bruno Albuquerque <bga@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5701-git-serve.sh')
-rwxr-xr-x | t/t5701-git-serve.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh index 509f379d49..73e74a9c54 100755 --- a/t/t5701-git-serve.sh +++ b/t/t5701-git-serve.sh @@ -19,6 +19,7 @@ test_expect_success 'test capability advertisement' ' fetch=shallow server-option object-format=$(test_oid algo) + object-info 0000 EOF @@ -240,4 +241,29 @@ test_expect_success 'unexpected lines are not allowed in fetch request' ' grep "unexpected line: .this-is-not-a-command." err ' +# Test the basics of object-info +# +test_expect_success 'basics of object-info' ' + test-tool pkt-line pack >in <<-EOF && + command=object-info + object-format=$(test_oid algo) + 0001 + size + oid $(git rev-parse two:two.t) + oid $(git rev-parse two:two.t) + 0000 + EOF + + cat >expect <<-EOF && + size + $(git rev-parse two:two.t) $(wc -c <two.t | xargs) + $(git rev-parse two:two.t) $(wc -c <two.t | xargs) + 0000 + EOF + + test-tool serve-v2 --stateless-rpc <in >out && + test-tool pkt-line unpack <out >actual && + test_cmp expect actual +' + test_done |