Re: [PATCH 3/3] fetch: die on invalid --negotiation-tip hash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 14 2021, Jonathan Tan wrote:

>> >> diff --git a/builtin/fetch.c b/builtin/fetch.c
>> >> index 9191620e50..2c50465cff 100644
>> >> --- a/builtin/fetch.c
>> >> +++ b/builtin/fetch.c
>> >> @@ -1428,7 +1428,9 @@ static void add_negotiation_tips(struct git_transport_options *smart_options)
>> >>  		if (!has_glob_specials(s)) {
>> >>  			struct object_id oid;
>> >>  			if (get_oid(s, &oid))
>> >> -				die("%s is not a valid object", s);
>> >> +				die(_("%s is not a valid object"), s);
>> >> +			if (!has_object(the_repository, &oid, 0))
>> >> +				die(_("%s is not a valid object"), s);
>> > Any reason not to consolidate these, e.g. if (get_oid || !has_object)?
>> > Then we wouldn't dup the err string.
>> 
>> Generally I'd agree, but aren't we explicitly conflating cases where
>> something is a valid way no name an object v.s. being certain that such
>> an object does not exist? I.e. this should be something like:
>> 
>>     if can't get_get():
>>         error "couldn't get the OID of revision '%s'"
>>     if can't look up fully-qualified OID:
>>         error "the OID '%s' does not exist"
>> 
>> Or something...
>
> Good point. I'll use wording similar to yours.

I stole the former from a quick grepping around:

    builtin/bisect--helper.c: res = error(_("couldn't get the oid of the rev '%s'"), rev)

Then http-push.c suggests "perhaps you need to fetch" for
has_object_file(), but I don't know if it applies here...



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux