Re: [PATCH 22/44] fetch-pack: parse and advertise the object-format capability
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- May 16, 2020, 11:03 UTC
- Message-ID
- <CAN0heSrGJV4u2JJW98AbmQum-=KgDeBsDvRUU_RzbPHNfbcaUg@mail.gmail.com>
- In-Reply-To
- <20200513005424.81369-23-sandals@crustytoothpaste.net>
On Wed, 13 May 2020 at 02:56, brian m. carlson <sandals@crustytoothpaste.net> wrote:
> > Parse the server's object-format capability and respond accordingly, > dying if there is a mismatch.
Show 10 quoted lines
> + if (server_feature_v2("object-format", &hash_name)) {
> + int hash_algo = hash_algo_by_name(hash_name);
> + if (hash_algo_by_ptr(the_hash_algo) != hash_algo)
> + die(_("mismatched algorithms: client %s; server %s"),
> + the_hash_algo->name, hash_name);
> + packet_write_fmt(fd_out, "object-format=%s", the_hash_algo->name);
> + }
> + else if (hash_algo_by_ptr(the_hash_algo) != GIT_HASH_SHA1)
> + die(_("the server does not support algorithm '%s'"),
> + the_hash_algo->name);Micronit: "} else if (...) {", i.e., join to one line and add braces.Martin