Re: [PATCH v4 32/39] setup: add support for reading extensions.objectformat
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 26, 2020, 23:34 UTC
- Message-ID
- <CAPig+cSaqwwtOitm3_3kF+q9TaputNAnz78qBb-7PfrZcqUDVg@mail.gmail.com>
- In-Reply-To
- <20200726195424.626969-33-sandals@crustytoothpaste.net>
On Sun, Jul 26, 2020 at 3:56 PM brian m. carlson <sandals@crustytoothpaste.net> wrote:
Show 20 quoted lines
> The transition plan specifies extensions.objectFormat as the indication
> that we're using a given hash in a certain repo. Read this as one of
> the extensions we support. If the user has specified an invalid value,
> fail.
>
> Ensure that we reject the extension if the repository format version is
> 0.
>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
> diff --git a/setup.c b/setup.c
> @@ -470,7 +470,16 @@ static int check_repo_format(const char *var, const char *value, void *vdata)
> + else if (!strcmp(ext, "objectformat")) {
> + int format;
> +
> + if (!value)
> + return config_error_nonbool(var);
> + format = hash_algo_by_name(value);
> + if (format == GIT_HASH_UNKNOWN)
> + return error("invalid value for 'extensions.objectformat'");Not necessarily worth a re-roll, but this error message could be more helpful by providing additional context:
return error("invalid value for extensions.objectFormat: %s", value);Notice I also capitalized "Format" since this is a user-facing message.
Also, should this message be localizable _(...)?