Re: [PATCH 2/2] refs: add GIT_REF_URI to specify reference backend and directory
Toon Claes <toon@iotcl.com> writes:
[snip]
Show 23 quoted lines
>> diff --git a/refs.c b/refs.c
>> index 23f46867f2..0922f08c9f 100644
>> --- a/refs.c
>> +++ b/refs.c
>> @@ -2186,15 +2186,66 @@ static struct ref_store *get_ref_store_for_dir(struct repository *r,
>> return maybe_debug_wrap_ref_store(dir, ref_store);
>> }
>>
>> +static struct ref_store *get_ref_store_from_uri(struct repository *repo,
>> + const char *uri)
>> +{
>> + struct string_list ref_backend_info = STRING_LIST_INIT_DUP;
>> + enum ref_storage_format format;
>> + struct ref_store *store = NULL;
>> + char *format_string;
>> + char *dir;
>> +
>> + if (!uri || !uri[0]) {
>> + error("reference backend uri is empty");
>
> I see no localization on any of the error() or die() messages. I think
> it's worth to make them translatable.
>Show 14 quoted lines
>> + goto cleanup;
>> + }
>> +
>> + if (string_list_split(&ref_backend_info, uri, ":", 2) != 2) {
>> + error("invalid reference backend uri format '%s'", uri);
>> + goto cleanup;
>> + }
>> +
>> + format_string = ref_backend_info.items[0].string;
>> + dir = ref_backend_info.items[1].string + 2;
>
> Length check before jumping to the third char would be adviced. Also I
> think it's worth to check if the first two chars are "//".
>This is a good point, will add a test and fix this up.
> --
> Cheers,
> Toon