Re: [PATCH 15/44] builtin/receive-pack: detect when the server doesn't support our hash
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- May 16, 2020, 10:41 UTC
- Message-ID
- <CAN0heSr3eAZrXnp8OoA6m1Hmfcgno7Dr2VK8m4jQqGHmgYySLA@mail.gmail.com>
- In-Reply-To
- <20200513005424.81369-16-sandals@crustytoothpaste.net>
On Wed, 13 May 2020 at 02:56, brian m. carlson <sandals@crustytoothpaste.net> wrote:
> + const char *hash; > + int len = 0;
Micronit: These new variables are used in tandem. I could see these as "NULL, 0" or both uninitialized, but this is a mixture. That's a really small nit, of course. (Maybe you needed to fight a compiler warning?)
Show 7 quoted lines
> + hash = parse_feature_value(feature_list, "object-format", &len, NULL);
> + if (!hash) {
> + hash = hash_algos[GIT_HASH_SHA1].name;
> + len = strlen(hash);
> + }
> + if (xstrncmpz(the_hash_algo->name, hash, len))
> + die("error: unsupported object format '%s'", hash);Ok, this is a familiar pattern by now: if we get nothing, behave as if we got SHA-1.
Martin