Re: [PATCH GSoC 2/5] fetch-object-info: parse type from server response

Karthik Nayak <[email protected]> Wed, 29 Jul 2026 17:53:27 -0500
Newsgroups org.kernel.vger.git
Message-ID <CAOLa=ZSdh8EeikBfTn58sNpfSQ=M2VwE5eA25c2ckQYhx6wjBQ@mail.gmail.com>
Karthik Nayak <[email protected]> writes:

>> @@ -148,6 +154,10 @@ int fetch_object_info(const enum protocol_version version, struct object_info_ar
>>  			    object_info_values.items[0].string,
>>  			    object_info_values.items[size_index + 1].string);
>>
>> +		if (type_index >= 0)
>> +			*object_info_data[i].typep =
>> +				type_from_string(object_info_values.items[type_index + 1].string);
>> +
>
> For size, passing the value as a number makes sense, since the value
> represents the field directly.
>
> For type however, we're passing in a value, while the actual field is a
> string. We rely on `type_from_string()` to make that translation for us,
> which internatlly depends on `object_type_strings[]`. What if there is a
> mismatch between the server and the client? Shouldn't we be sending in
> the string itself?
>
>>  		string_list_clear(&object_info_values, 0);
>>  	}
>>  	check_stateless_delimiter(stateless_rpc, reader, "stateless delimiter expected");
>>
>> --
>> 2.54.0

Ah! We do send in the string itself, all good here :)
signature.asc (application/pgp-signature, 690 B)
-----BEGIN PGP SIGNATURE-----

iQHKBAEBCgA0FiEEV85Mf2N1cQ/LZcYGPtWfJI5GjH8FAmpqhGUWHGthcnRoaWsu
MTg4QGdtYWlsLmNvbQAKCRA+1Z8kjkaMf3mzC/4p7Rclt40I8ebn+jMF5Vixz/qi
DA3o0/Aytd0xZYdry5EhKRQmde6NnM2ZvL7lnrRorUjMBcLY9JmGhvfmUrNCj03z
ITyZAq+bXDM+6mkgWO9Dy3qxlDmPTbEWwvhLKdkU0QQNlGRAgxtsDyEQufj59H2P
6NvLHNIJ4u6A83yUHBzbkLa8R8JnXRmqomQkkbt8UQ9qdMmyPAlSFpZ69msF0Ugv
3kvHFA0AlMhbHNUJlpz0hofwgsll1+T4J2Mi8yC8ms0LSXHbx0Xa9Y3kFPRrvgLl
zYb85n+TYBsAHj2Kx8ERYhtfwl84TGiqjcbO+LGui+yDrft5H6BZn93xPW0LTrhX
qKYSjMmxTytecQlmcT3w/uOK/whL+l9opitQqOE2Lo+6xzxorQAyxDyfT1WMGG9n
yTelDxJ+C/VVpdheEsywxpx6r/sQ4qqQDfhZFGjADu6Xgu3YvExHzgKUJWeDhbOd
kBjDUM19cbD0GvEsPwrnZsD6BVbD7rWJEcYCDJc=
=tztK
-----END PGP SIGNATURE-----