In order for a client to know what object-info components a server can provide, advertise supported object-info features. This will allow a client to decide whether to query the server for object-info or fetch as a fallback. Signed-off-by: Calvin Wan <calvinwan@xxxxxxxxxx> Helped-by: Jonathan Tan <jonathantanmy@xxxxxxxxxx> --- serve.c | 10 +++++++++- t/t5555-http-smart-common.sh | 2 +- t/t5701-git-serve.sh | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/serve.c b/serve.c index 733347f602..1adf9df4a8 100644 --- a/serve.c +++ b/serve.c @@ -56,6 +56,14 @@ static int session_id_advertise(struct repository *r, struct strbuf *value) return 1; } +static int object_info_advertise(struct repository *r, + struct strbuf *value) +{ + if (value) + strbuf_addstr(value, "size"); + return 1; +} + static void session_id_receive(struct repository *r, const char *client_sid) { @@ -132,7 +140,7 @@ static struct protocol_capability capabilities[] = { }, { .name = "object-info", - .advertise = always_advertise, + .advertise = object_info_advertise, .command = cap_object_info, }, }; diff --git a/t/t5555-http-smart-common.sh b/t/t5555-http-smart-common.sh index b1cfe8b7db..5a16d4259a 100755 --- a/t/t5555-http-smart-common.sh +++ b/t/t5555-http-smart-common.sh @@ -131,7 +131,7 @@ test_expect_success 'git upload-pack --advertise-refs: v2' ' fetch=shallow wait-for-done server-option object-format=$(test_oid algo) - object-info + object-info=size 0000 EOF diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh index 1896f671cb..ebb32644e3 100755 --- a/t/t5701-git-serve.sh +++ b/t/t5701-git-serve.sh @@ -20,7 +20,7 @@ test_expect_success 'test capability advertisement' ' fetch=shallow wait-for-done server-option object-format=$(test_oid algo) - object-info + object-info=size 0000 EOF -- 2.37.1.455.g008518b4e5-goog