git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "lilinchao@oschina.cn" <lilinchao@oschina.cn>
To: "Li Linchao via GitGitGadget" <gitgitgadget@gmail.com>,
	git <git@vger.kernel.org>
Cc: "Jeff King" <peff@peff.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH v2] rev-list: support human-readable output for `--disk-usage`
Date: Mon, 8 Aug 2022 17:37:27 +0800	[thread overview]
Message-ID: <202208081735108064497@oschina.cn> (raw)
In-Reply-To: pull.1313.v2.git.1659947722132.gitgitgadget@gmail.com

>       static int show_disk_usage;
>     @@ builtin/rev-list.c: static int try_bitmap_disk_usage(struct rev_info *revs,
>       int filter_provided_objects)
>       {
>       struct bitmap_index *bitmap_git;
>     -+	struct strbuf bitmap_size_buf = STRBUF_INIT;
>     ++	struct strbuf disk_buf = STRBUF_INIT;
>      +	off_t size_from_bitmap;
In next iteration, will move these two lines to more close to their caller place to
avoid early return.
>      
>       if (!show_disk_usage)
>     @@ builtin/rev-list.c: static int try_bitmap_disk_usage(struct rev_info *revs,
>      -	printf("%"PRIuMAX"\n",
>      -	       (uintmax_t)get_disk_usage_from_bitmap(bitmap_git, revs));
>      +	size_from_bitmap = get_disk_usage_from_bitmap(bitmap_git, revs);
>     -+	if (human_readable) {
>     -+	strbuf_humanise_bytes(&bitmap_size_buf, size_from_bitmap);
>     -+	printf("%s\n", bitmap_size_buf.buf);
>     -+	} else
>     -+	printf("%"PRIuMAX"\n", (uintmax_t)size_from_bitmap);
>     -+	strbuf_release(&bitmap_size_buf);
>     ++	if (human_readable)
>     ++	strbuf_humanise_bytes(&disk_buf, size_from_bitmap);
>     ++	else
>     ++	strbuf_addf(&disk_buf, "%"PRIuMAX"", (uintmax_t)size_from_bitmap);
>     ++	puts(disk_buf.buf);
>     ++	strbuf_release(&disk_buf);
>       return 0;
>       }


  reply	other threads:[~2022-08-08  9:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  7:54 [PATCH] rev-list: support `--human-readable` option when applied `disk-usage` Li Linchao via GitGitGadget
2022-08-05 10:03 ` Ævar Arnfjörð Bjarmason
2022-08-05 11:01   ` lilinchao
2022-08-08  8:35 ` [PATCH v2] rev-list: support human-readable output for `--disk-usage` Li Linchao via GitGitGadget
2022-08-08  9:37   ` lilinchao [this message]
2022-08-09 13:22   ` Jeff King
2022-08-09 16:46     ` lilinchao
2022-08-10  6:01   ` [PATCH v3] " Li Linchao via GitGitGadget
2022-08-10  7:18     ` Johannes Sixt
2022-08-10 11:14     ` [PATCH v4] " Li Linchao via GitGitGadget
2022-08-10 17:34       ` Junio C Hamano
2022-08-10 21:20         ` Jeff King
2022-08-10 21:25           ` Junio C Hamano
2022-08-11  5:20           ` Junio C Hamano
2022-08-11  8:38             ` Jeff King
2022-08-11  4:47       ` [PATCH v5] " Li Linchao via GitGitGadget
2022-08-11 20:49         ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=202208081735108064497@oschina.cn \
    --to=lilinchao@oschina.cn \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).