2018-02-15 8:37 GMT+03:00 Jeff King <p...@peff.net>:
> On Mon, Feb 12, 2018 at 08:08:54AM +0000, Olga Telezhnaya wrote:
>
>> Continue migrating formatting logic from cat-file to ref-filter.
>> Reuse parse_ref_filter_atom() for unifying all processes in ref-filter
>> and further removing of mark_atom_in_object_info().
>
> OK, now it looks we're moving in a good direction.
>
> One thing that puzzles me:
>
>> @@ -401,20 +420,14 @@ static int is_atom(const char *atom, const char *s, 
>> int slen)
>>  static void mark_atom_in_object_info(const char *atom, int len,
>>                                   struct expand_data *data)
>>  {
>> -     if (is_atom("objectname", atom, len))
>> -             ; /* do nothing */
>> -     else if (is_atom("objecttype", atom, len))
>> +     if (is_atom("objecttype", atom, len))
>>               data->info.typep = &data->type;
>>       else if (is_atom("objectsize", atom, len))
>>               data->info.sizep = &data->size;
>> -     else if (is_atom("objectsize:disk", atom, len))
>> -             data->info.disk_sizep = &data->disk_size;
>>       else if (is_atom("rest", atom, len))
>>               data->split_on_whitespace = 1;
>>       else if (is_atom("deltabase", atom, len))
>>               data->info.delta_base_sha1 = data->delta_base_oid.hash;
>> -     else
>> -             die("unknown format element: %.*s", len, atom);
>>  }
>
> Why do some of these atoms go away and not others?

I deleted "objectname" because we were doing nothing there;
"objectsize:disk" because we have its own parser function;
"die" because ref-filter has its own checker whether the atom is valid or not.
I left all others because I haven't supported them at that point. This
whole function will be removed later.

> It seems like we're
> now relying on ref-filter to parse some of the common ones using its
> existing atom-parser. But wouldn't it have objecttype and objectsize
> already, then?

We haven't migrated enough to ref-filter at this point and we can't
reuse general ref-filter logic about filling the fields. So, we still
need to have our own function for doing that. Anyway, as I said
earlier, we will reach that status in the end of the patch: this
function would be deleted and we will use general ref-filter logic.

>
> -Peff

Reply via email to