Re: [PATCH v3 20/23] ref-filter: unifying formatting of cat-file opts
- From
Оля Тележная <olyatelezhnaya@gmail.com>
- Date
- Feb 15, 2018, 10:34 UTC
- Message-ID
- <CAL21BmkVgCzihUOxM=Mih=EzYKZwYzpgkSrAZFVr12nkfoCtXw@mail.gmail.com>
- In-Reply-To
- <20180215055618.GP18780@sigill.intra.peff.net>
2018-02-15 8:56 GMT+03:00 Jeff King <peff@peff.net>:
Show 31 quoted lines
> On Mon, Feb 12, 2018 at 08:08:54AM +0000, Olga Telezhnaya wrote:
>
>> cat-file options are now filled by general logic.
>
> Yay.
>
> One puzzling thing:
>
>> diff --git a/ref-filter.c b/ref-filter.c
>> index 8d104b567eb7c..5781416cf9126 100644
>> --- a/ref-filter.c
>> +++ b/ref-filter.c
>> @@ -824,8 +824,12 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
>> else if (!strcmp(name, "objectsize")) {
>> v->value = sz;
>> v->s = xstrfmt("%lu", sz);
>> - }
>> - else if (deref)
>> + } else if (!strcmp(name, "objectsize:disk")) {
>> + if (cat_file_info.is_cat_file) {
>> + v->value = cat_file_info.disk_size;
>> + v->s = xstrfmt("%"PRIuMAX, (uintmax_t)v->value);
>> + }
>> + } else if (deref)
>
> Why do we care about is_cat_file here. Shouldn't:
>
> git for-each-ref --format='%(objectsize:disk)'
>
> work? I.e., shouldn't the cat_file_info.disk_size variable be held
> somewhere in a used_atom struct?At that point - no. I think it sounds like other separate task to add this functionality and to test it properly.
> > -Peff