From patchwork Mon Dec 24 13:24:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Telezhnaya X-Patchwork-Id: 10742293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5FBEB161F for ; Mon, 24 Dec 2018 13:24:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CA8928AD4 for ; Mon, 24 Dec 2018 13:24:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 413BF28AD6; Mon, 24 Dec 2018 13:24:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5451928AF8 for ; Mon, 24 Dec 2018 13:24:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726382AbeLXNYh (ORCPT ); Mon, 24 Dec 2018 08:24:37 -0500 Received: from a7-11.smtp-out.eu-west-1.amazonses.com ([54.240.7.11]:44964 "EHLO a7-11.smtp-out.eu-west-1.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1545657870; h=From:To:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=9YGepsMJUdpPw7b1C2yYCMIfHA1NSvuWSKGGBpzSG+o=; b=SOKHbojMmKri5wbv6frIdT4aCswFlFYCiT0tQoLH+69pW96GxvlhgFHLoIU93eA3 qQNolvGgnOUpb5eqBgHbxS9C4jynHFcJSdSAvhQRrJYGNjKpNwLpsBApLvxWus05Gyv 2KXpq7H64LL7UuhMaBaa4KvuwL8CTBKZYqPZW7gw= From: Olga Telezhnaya To: git@vger.kernel.org Message-ID: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> In-Reply-To: References: Subject: [PATCH v2 1/6] ref-filter: add objectsize:disk option MIME-Version: 1.0 Date: Mon, 24 Dec 2018 13:24:30 +0000 X-SES-Outgoing: 2018.12.24-54.240.7.11 Feedback-ID: 1.eu-west-1.YYPRFFOog89kHDDPKvTu4MK67j4wW0z7cAgZtFqQH58=:AmazonSES Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add new formatting option objectsize:disk to know exact size that object takes up on disk. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) -- https://github.com/git/git/pull/552 diff --git a/ref-filter.c b/ref-filter.c index 5de616befe46e..fd95547676047 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -231,12 +231,18 @@ static int objecttype_atom_parser(const struct ref_format *format, struct used_a static int objectsize_atom_parser(const struct ref_format *format, struct used_atom *atom, const char *arg, struct strbuf *err) { - if (arg) - return strbuf_addf_ret(err, -1, _("%%(objectsize) does not take arguments")); - if (*atom->name == '*') - oi_deref.info.sizep = &oi_deref.size; - else - oi.info.sizep = &oi.size; + if (!arg) { + if (*atom->name == '*') + oi_deref.info.sizep = &oi_deref.size; + else + oi.info.sizep = &oi.size; + } else if (!strcmp(arg, "disk")) { + if (*atom->name == '*') + oi_deref.info.disk_sizep = &oi_deref.disk_size; + else + oi.info.disk_sizep = &oi.disk_size; + } else + return strbuf_addf_ret(err, -1, _("unrecognized %%(objectsize) argument: %s"), arg); return 0; } @@ -880,7 +886,10 @@ 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("%"PRIuMAX, (intmax_t)oi->disk_size); + } else if (!strcmp(name, "objectsize")) { v->value = oi->size; v->s = xstrfmt("%"PRIuMAX , (uintmax_t)oi->size); } From patchwork Mon Dec 24 13:24:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Telezhnaya X-Patchwork-Id: 10742297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A44413B5 for ; Mon, 24 Dec 2018 13:24:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86FA228AD4 for ; Mon, 24 Dec 2018 13:24:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BCE028AF8; Mon, 24 Dec 2018 13:24:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28BC628AD4 for ; Mon, 24 Dec 2018 13:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726331AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 Received: from a7-20.smtp-out.eu-west-1.amazonses.com ([54.240.7.20]:45136 "EHLO a7-20.smtp-out.eu-west-1.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1545657870; h=From:To:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=YWpxiWy87APy4CoRq/gxvhwxiu+Lf1AP4P+1msMcCpw=; b=NIRLU9aaCsS+1L3FHR+vy3Pzx21lmfIAdPTe5hYq2ygTG0W7tO2LeeExVB6yvnop i/lCE10eJ3P+LjMOdgSqqqxBAZkh+QZCHiYT2gt5SZJecXYR14XxfwGwAV08ilwL+lf VURDE7E4Kz8IVI8kL46aIfS1usfzpi5K4y1kxUxA= From: Olga Telezhnaya To: git@vger.kernel.org Message-ID: <01020167e06368cb-7c85a9f8-c94c-47a6-9068-929e11104cec-000000@eu-west-1.amazonses.com> In-Reply-To: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> References: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> Subject: [PATCH v2 2/6] ref-filter: add check for negative file size MIME-Version: 1.0 Date: Mon, 24 Dec 2018 13:24:30 +0000 X-SES-Outgoing: 2018.12.24-54.240.7.20 Feedback-ID: 1.eu-west-1.YYPRFFOog89kHDDPKvTu4MK67j4wW0z7cAgZtFqQH58=:AmazonSES Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we have negative file size, we are doing something wrong. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 2 ++ 1 file changed, 2 insertions(+) -- https://github.com/git/git/pull/552 diff --git a/ref-filter.c b/ref-filter.c index fd95547676047..45c558bcbd521 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1491,6 +1491,8 @@ static int get_object(struct ref_array_item *ref, int deref, struct object **obj OBJECT_INFO_LOOKUP_REPLACE)) return strbuf_addf_ret(err, -1, _("missing object %s for %s"), oid_to_hex(&oi->oid), ref->refname); + if (oi->info.disk_sizep && oi->disk_size < 0) + BUG("Object size is less than zero."); if (oi->info.contentp) { *obj = parse_object_buffer(the_repository, &oi->oid, oi->type, oi->size, oi->content, &eaten); From patchwork Mon Dec 24 13:24:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Telezhnaya X-Patchwork-Id: 10742289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46EFB13B5 for ; Mon, 24 Dec 2018 13:24:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35BBD28AD6 for ; Mon, 24 Dec 2018 13:24:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A95428B01; Mon, 24 Dec 2018 13:24:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1049B28AD6 for ; Mon, 24 Dec 2018 13:24:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726163AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 Received: from a7-18.smtp-out.eu-west-1.amazonses.com ([54.240.7.18]:46384 "EHLO a7-18.smtp-out.eu-west-1.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725763AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1545657870; h=From:To:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=LteZiyG4GvnRbfmbT6nR+Yr3mGsc4eQ0DTIRWP4awT0=; b=Z0ViiyJNvTOWfeIFfPJ7fSln0UtNEIgmnqdizrzmmJHfSj+ByD2aK/xPNQZ3YxB2 uAqfl1PsIczQfLSQydrvBY1yVBGF9+ox9KgX19aggcItg/BxrPra/nLa4JEQqI2ngZ/ OZKuZ3DhAkAF1HsZgsc0hhpCiDMhs8jcGP7TY20Q= From: Olga Telezhnaya To: git@vger.kernel.org Message-ID: <01020167e06368d8-783d15ea-9847-48bc-b3be-aa57b45ffe92-000000@eu-west-1.amazonses.com> In-Reply-To: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> References: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> Subject: [PATCH v2 3/6] ref-filter: add tests for objectsize:disk MIME-Version: 1.0 Date: Mon, 24 Dec 2018 13:24:30 +0000 X-SES-Outgoing: 2018.12.24-54.240.7.18 Feedback-ID: 1.eu-west-1.YYPRFFOog89kHDDPKvTu4MK67j4wW0z7cAgZtFqQH58=:AmazonSES Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Test new formatting atom. Signed-off-by: Olga Telezhnaia --- t/t6300-for-each-ref.sh | 3 +++ 1 file changed, 3 insertions(+) -- https://github.com/git/git/pull/552 diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 97bfbee6e8d69..097fdf21fe196 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -83,6 +83,7 @@ test_atom head push:strip=1 remotes/myfork/master test_atom head push:strip=-1 master test_atom head objecttype commit test_atom head objectsize 171 +test_atom head objectsize:disk 138 test_atom head objectname $(git rev-parse refs/heads/master) test_atom head objectname:short $(git rev-parse --short refs/heads/master) test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) @@ -124,6 +125,8 @@ test_atom tag upstream '' test_atom tag push '' test_atom tag objecttype tag test_atom tag objectsize 154 +test_atom tag objectsize:disk 138 +test_atom tag '*objectsize:disk' 138 test_atom tag objectname $(git rev-parse refs/tags/testtag) test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag) test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) From patchwork Mon Dec 24 13:24:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Telezhnaya X-Patchwork-Id: 10742287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AEEB13B5 for ; Mon, 24 Dec 2018 13:24:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A3928AF8 for ; Mon, 24 Dec 2018 13:24:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D67728B01; Mon, 24 Dec 2018 13:24:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6837E28B05 for ; Mon, 24 Dec 2018 13:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726373AbeLXNYd (ORCPT ); Mon, 24 Dec 2018 08:24:33 -0500 Received: from a7-10.smtp-out.eu-west-1.amazonses.com ([54.240.7.10]:49728 "EHLO a7-10.smtp-out.eu-west-1.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1545657870; h=From:To:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=vRydY3jQAIZmK8RisuR91RIpW8OU3Kj9+ADG4CFPsyA=; b=Ty+FdA40TzdH0HxMhYRHEvC0sM9Jne1iOYyTCGU+n7kBeQgRol3nMsKcF9I9JK5e OA2obwZMvOIvnGZY59gBBn005TSN5fZB3rp8hPlnD+H0Cc/Rekt8kO/Ac+mTMHESokW 8Jm50KCxNwe3qEAsWD3fvFBY0z7D3pafppVK+EWo= From: Olga Telezhnaya To: git@vger.kernel.org Message-ID: <01020167e06368eb-576f5c6e-b54d-4169-971d-a1affed08551-000000@eu-west-1.amazonses.com> In-Reply-To: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> References: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> Subject: [PATCH v2 4/6] ref-filter: add deltabase option MIME-Version: 1.0 Date: Mon, 24 Dec 2018 13:24:30 +0000 X-SES-Outgoing: 2018.12.24-54.240.7.10 Feedback-ID: 1.eu-west-1.YYPRFFOog89kHDDPKvTu4MK67j4wW0z7cAgZtFqQH58=:AmazonSES Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add new formatting option: deltabase. If the object is stored as a delta on-disk, this expands to the 40-hex sha1 of the delta base object. Otherwise, expands to the null sha1 (40 zeroes). We have same option in cat-file command. Hopefully, in the end I will remove formatting code from cat-file and reuse formatting parts from ref-filter. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- https://github.com/git/git/pull/552 diff --git a/ref-filter.c b/ref-filter.c index 45c558bcbd521..debb8cacad067 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -246,6 +246,18 @@ static int objectsize_atom_parser(const struct ref_format *format, struct used_a return 0; } +static int deltabase_atom_parser(const struct ref_format *format, struct used_atom *atom, + const char *arg, struct strbuf *err) +{ + if (arg) + return strbuf_addf_ret(err, -1, _("%%(deltabase) does not take arguments")); + if (*atom->name == '*') + oi_deref.info.delta_base_sha1 = oi_deref.delta_base_oid.hash; + else + oi.info.delta_base_sha1 = oi.delta_base_oid.hash; + return 0; +} + static int body_atom_parser(const struct ref_format *format, struct used_atom *atom, const char *arg, struct strbuf *err) { @@ -437,6 +449,7 @@ static struct { { "objecttype", SOURCE_OTHER, FIELD_STR, objecttype_atom_parser }, { "objectsize", SOURCE_OTHER, FIELD_ULONG, objectsize_atom_parser }, { "objectname", SOURCE_OTHER, FIELD_STR, objectname_atom_parser }, + { "deltabase", SOURCE_OTHER, FIELD_STR, deltabase_atom_parser }, { "tree", SOURCE_OBJ }, { "parent", SOURCE_OBJ }, { "numparent", SOURCE_OBJ, FIELD_ULONG }, @@ -892,7 +905,8 @@ static void grab_common_values(struct atom_value *val, int deref, struct expand_ } else if (!strcmp(name, "objectsize")) { v->value = oi->size; v->s = xstrfmt("%"PRIuMAX , (uintmax_t)oi->size); - } + } else if (!strcmp(name, "deltabase")) + v->s = xstrdup(oid_to_hex(&oi->delta_base_oid)); else if (deref) grab_objectname(name, &oi->oid, v, &used_atom[i]); } From patchwork Mon Dec 24 13:24:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Telezhnaya X-Patchwork-Id: 10742291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1F0714E2 for ; Mon, 24 Dec 2018 13:24:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0E7228AD4 for ; Mon, 24 Dec 2018 13:24:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 957C828B01; Mon, 24 Dec 2018 13:24:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABD3C28AD6 for ; Mon, 24 Dec 2018 13:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 Received: from a7-17.smtp-out.eu-west-1.amazonses.com ([54.240.7.17]:37554 "EHLO a7-17.smtp-out.eu-west-1.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1545657870; h=From:To:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=ImRxXuYDUEWle310kt75qYmF/rXx2XuFAAHDRp4yavA=; b=u5ujpw9S+w//pe+PoOsKpw6dhWUIo32zf5as2Byi+d6yrbItc1Yub7Uvgyp5Gjgz tJtlsW93G+2dgpyDXBVUYdii9FojVeVomE+x1B+Yj/qFocFMdKNWYpFIKUO3eCbNXAB 9FhKkSDyifBL9ajMaXPIao7vIIu04kyjf2TeUpBE= From: Olga Telezhnaya To: git@vger.kernel.org Message-ID: <01020167e06368ee-092ccd7f-6f37-425b-9eb3-bdd9b1cb8358-000000@eu-west-1.amazonses.com> In-Reply-To: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> References: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> Subject: [PATCH v2 5/6] ref-filter: add tests for deltabase MIME-Version: 1.0 Date: Mon, 24 Dec 2018 13:24:30 +0000 X-SES-Outgoing: 2018.12.24-54.240.7.17 Feedback-ID: 1.eu-west-1.YYPRFFOog89kHDDPKvTu4MK67j4wW0z7cAgZtFqQH58=:AmazonSES Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Test new formatting option deltabase. Signed-off-by: Olga Telezhnaia --- t/t6300-for-each-ref.sh | 3 +++ 1 file changed, 3 insertions(+) -- https://github.com/git/git/pull/552 diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 097fdf21fe196..0ffd63071392e 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -84,6 +84,7 @@ test_atom head push:strip=-1 master test_atom head objecttype commit test_atom head objectsize 171 test_atom head objectsize:disk 138 +test_atom head deltabase 0000000000000000000000000000000000000000 test_atom head objectname $(git rev-parse refs/heads/master) test_atom head objectname:short $(git rev-parse --short refs/heads/master) test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) @@ -127,6 +128,8 @@ test_atom tag objecttype tag test_atom tag objectsize 154 test_atom tag objectsize:disk 138 test_atom tag '*objectsize:disk' 138 +test_atom tag deltabase 0000000000000000000000000000000000000000 +test_atom tag '*deltabase' 0000000000000000000000000000000000000000 test_atom tag objectname $(git rev-parse refs/tags/testtag) test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag) test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master) From patchwork Mon Dec 24 13:24:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Telezhnaya X-Patchwork-Id: 10742285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46D7613B5 for ; Mon, 24 Dec 2018 13:24:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3499528AD6 for ; Mon, 24 Dec 2018 13:24:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28E0E28B26; Mon, 24 Dec 2018 13:24:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 115AB28AD6 for ; Mon, 24 Dec 2018 13:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726361AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 Received: from a7-10.smtp-out.eu-west-1.amazonses.com ([54.240.7.10]:49730 "EHLO a7-10.smtp-out.eu-west-1.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbeLXNYc (ORCPT ); Mon, 24 Dec 2018 08:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=uku4taia5b5tsbglxyj6zym32efj7xqv; d=amazonses.com; t=1545657870; h=From:To:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Date:Feedback-ID; bh=QqsQOMsAKbX8VhSWwkhRkBkLAD9uhddMbS7hwh+Laik=; b=SVziePt/A3+0idsbqV8PdNmH2I6beFj5F9BTuXr3rFIczK7gdvHL2SJRJjKIU+07 BSnECTfGIc38DI4OHfWPwi3g8KaVTYQY6SxtO34n9By+yedWteRITZvxOR31aQGhbC9 iuGUV2t45zL2DU4y0u+1xyeMQQFEUK8EItMeUTBU= From: Olga Telezhnaya To: git@vger.kernel.org Message-ID: <01020167e0636912-b5ab3444-ff8a-4958-916e-e155a80dcc37-000000@eu-west-1.amazonses.com> In-Reply-To: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> References: <01020167e063687c-37a43a09-0a5f-4335-8c21-ec15a0a67882-000000@eu-west-1.amazonses.com> Subject: [PATCH v2 6/6] ref-filter: add docs for new options MIME-Version: 1.0 Date: Mon, 24 Dec 2018 13:24:30 +0000 X-SES-Outgoing: 2018.12.24-54.240.7.10 Feedback-ID: 1.eu-west-1.YYPRFFOog89kHDDPKvTu4MK67j4wW0z7cAgZtFqQH58=:AmazonSES Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add documentation for formatting options objectsize:disk and deltabase. Signed-off-by: Olga Telezhnaia --- Documentation/git-for-each-ref.txt | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) -- https://github.com/git/git/pull/552 diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt index 901faef1bfdce..774cecc7ede78 100644 --- a/Documentation/git-for-each-ref.txt +++ b/Documentation/git-for-each-ref.txt @@ -128,13 +128,18 @@ objecttype:: objectsize:: The size of the object (the same as 'git cat-file -s' reports). - + Append `:disk` to get the size, in bytes, that the object takes up on + disk. See the note about on-disk sizes in the `CAVEATS` section below. objectname:: The object name (aka SHA-1). For a non-ambiguous abbreviation of the object name append `:short`. For an abbreviation of the object name with desired length append `:short=`, where the minimum length is MINIMUM_ABBREV. The length may be exceeded to ensure unique object names. +deltabase:: + This expands to the object name of the delta base for the + given object, if it is stored as a delta. Otherwise it + expands to the null object name (all zeroes). upstream:: The name of a local ref which can be considered ``upstream'' @@ -361,6 +366,20 @@ This prints the authorname, if present. git for-each-ref --format="%(refname)%(if)%(authorname)%(then) Authored by: %(authorname)%(end)" ------------ +CAVEATS +------- + +Note that the sizes of objects on disk are reported accurately, but care +should be taken in drawing conclusions about which refs or objects are +responsible for disk usage. The size of a packed non-delta object may be +much larger than the size of objects which delta against it, but the +choice of which object is the base and which is the delta is arbitrary +and is subject to change during a repack. + +Note also that multiple copies of an object may be present in the object +database; in this case, it is undefined which copy's size or delta base +will be reported. + SEE ALSO -------- linkgit:git-show-ref[1]