diff options
Diffstat (limited to 'serve.c')
-rw-r--r-- | serve.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -1,7 +1,9 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "repository.h" #include "config.h" -#include "hash-ll.h" +#include "hash.h" #include "pkt-line.h" #include "version.h" #include "ls-refs.h" @@ -12,6 +14,7 @@ #include "trace2.h" static int advertise_sid = -1; +static int advertise_object_info = -1; static int client_hash_algo = GIT_HASH_SHA1; static int always_advertise(struct repository *r UNUSED, @@ -67,6 +70,17 @@ static void session_id_receive(struct repository *r UNUSED, trace2_data_string("transfer", NULL, "client-sid", client_sid); } +static int object_info_advertise(struct repository *r, struct strbuf *value UNUSED) +{ + if (advertise_object_info == -1 && + repo_config_get_bool(r, "transfer.advertiseobjectinfo", + &advertise_object_info)) { + /* disabled by default */ + advertise_object_info = 0; + } + return advertise_object_info; +} + struct protocol_capability { /* * The name of the capability. The server uses this name when @@ -135,7 +149,7 @@ static struct protocol_capability capabilities[] = { }, { .name = "object-info", - .advertise = always_advertise, + .advertise = object_info_advertise, .command = cap_object_info, }, { @@ -309,7 +323,7 @@ static int process_request(void) die("no command requested"); if (client_hash_algo != hash_algo_by_ptr(the_repository->hash_algo)) - die("mismatched object format: server %s; client %s\n", + die("mismatched object format: server %s; client %s", the_repository->hash_algo->name, hash_algos[client_hash_algo].name); |