git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Olga Telezhnaya <olyatelezhnaya@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] ref-filter: add objectsize:disk option
Date: Mon, 12 Nov 2018 14:03:20 +0900	[thread overview]
Message-ID: <xmqqr2fq3n1j.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <01020166f76d845f-1a02a31e-5094-4b27-974d-a23811066c58-000000@eu-west-1.amazonses.com> (Olga Telezhnaya's message of "Fri, 9 Nov 2018 07:44:01 +0000")

Olga Telezhnaya <olyatelezhnaya@gmail.com> writes:

> @@ -876,11 +882,13 @@ static void grab_common_values(struct atom_value *val, int deref, struct expand_
>  			name++;
>  		if (!strcmp(name, "objecttype"))
>  			v->s = xstrdup(type_name(oi->type));
> -		else if (!strcmp(name, "objectsize")) {
> +		else if (!strcmp(name, "objectsize:disk")) {
> +			v->value = oi->disk_size;
> +			v->s = xstrfmt("%lld", (long long)oi->disk_size);

oi.disk_size is off_t; do we know "long long" 

   (1) is available widely enough (I think it is from c99)?

   (2) is sufficiently wide so that we can safely cast off_t to?

   (3) will stay to be sufficiently wide as machines get larger
       together with standard types like off_t in the future?

I'd rather use intmax_t (as off_t is a signed integral type) so that
we do not have to worry about these questions in the first place.

> +		} else if (!strcmp(name, "objectsize")) {
>  			v->value = oi->size;
>  			v->s = xstrfmt("%lu", oi->size);

This is not a suggestion but is a genuine question, but I wonder if
two years down the road somebody who meets this API for the first
time find the asymmetry between "objectsize" and "objectsize:disk" a
tad strange and suggest the former to have "objectsize:real" or some
synonym.  Or we can consider "objectsize" the primary thing (hence
needing no colon-plus-modifier to clarify what kind of size we are
asking) and leave these two deliberatly asymmetric.  I am leaning
towards the latter myself.

> -		}
> -		else if (deref)
> +		} else if (deref)
>  			grab_objectname(name, &oi->oid, v, &used_atom[i]);
>  	}
>  }
>
> --
> https://github.com/git/git/pull/552

  parent reply	other threads:[~2018-11-12  5:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  7:37 [RFC PATCH 0/5] ref-filter: add new formatting options Оля Тележная
2018-11-09  7:44 ` [RFC PATCH 1/5] ref-filter: add objectsize:disk option Olga Telezhnaya
2018-11-09  7:44   ` [RFC PATCH 5/5] ref-filter: add docs for new options Olga Telezhnaya
2018-11-12  5:24     ` Junio C Hamano
2018-11-09  7:44   ` [RFC PATCH 3/5] ref-filter: add deltabase option Olga Telezhnaya
2018-11-09  7:44   ` [RFC PATCH 4/5] ref-filter: add tests for deltabase Olga Telezhnaya
2018-11-09  7:44   ` [RFC PATCH 2/5] ref-filter: add tests for objectsize:disk Olga Telezhnaya
2018-11-12  5:03   ` Junio C Hamano [this message]
2018-11-12 12:03     ` [RFC PATCH 1/5] ref-filter: add objectsize:disk option Johannes Schindelin
2018-11-12 13:12       ` Jeff King
2018-11-13  1:52         ` Junio C Hamano
2018-11-20  9:17           ` Оля Тележная
2018-11-21  0:27             ` Junio C Hamano
2018-11-22 11:33               ` Johannes Schindelin
2018-11-24  1:48                 ` Junio C Hamano
2018-11-12 13:05     ` Jeff King
2018-12-24 13:16 ` [PATCH v2 0/5] ref-filter: add new formatting options Оля Тележная
2018-12-24 13:24   ` [PATCH v2 1/6] ref-filter: add objectsize:disk option Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 6/6] ref-filter: add docs for new options Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 2/6] ref-filter: add check for negative file size Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 4/6] ref-filter: add deltabase option Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 5/6] ref-filter: add tests for deltabase Olga Telezhnaya
2018-12-24 13:24     ` [PATCH v2 3/6] ref-filter: add tests for objectsize:disk Olga Telezhnaya
2018-12-26 20:44     ` [PATCH v2 1/6] ref-filter: add objectsize:disk option Junio C Hamano
2019-01-10  6:25   ` [PATCH v2 0/5] ref-filter: add new formatting options Оля Тележная
2019-01-10  6:32     ` [PATCH v3 1/6] ref-filter: add objectsize:disk option Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 3/6] ref-filter: add tests for objectsize:disk Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 6/6] ref-filter: add docs for new options Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 4/6] ref-filter: add deltabase option Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 5/6] ref-filter: add tests for deltabase Olga Telezhnaya
2019-01-10  6:32       ` [PATCH v3 2/6] ref-filter: add check for negative file size Olga Telezhnaya
2019-01-10 18:17     ` [PATCH v2 0/5] ref-filter: add new formatting options Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr2fq3n1j.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=olyatelezhnaya@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).