git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] rev-list: support human-readable output for `--disk-usage`

From
Llilinchao@oschina.cn <lilinchao@oschina.cn>
Date
Aug 8, 2022, 09:37 UTC
Message-ID
<202208081735108064497@oschina.cn>
In-Reply-To
<pull.1313.v2.git.1659947722132.gitgitgadget@gmail.com>
Show 8 quoted lines
>       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.

Show 20 quoted lines
>      
>       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;
>       }
Previous: Li Linchao via GitGitGadgetNext: Jeff King
Message 5 of 17 in “rev-list: support `--human-readable` option when applied `disk-usage`”
  1. rev-list: support `--human-readable` option when applied `disk-usage`Li Linchao via GitGitGadget, Aug 5, 2022
  2. Ævar Arnfjörð BjarmasonAug 5, 2022
  3. lilinchao@oschina.cnAug 5, 2022
  4. rev-list: support human-readable output for `--disk-usage`Li Linchao via GitGitGadget, Aug 8, 2022
  5. lilinchao@oschina.cnAug 8, 2022
  6. Jeff KingAug 9, 2022
  7. lilinchao@oschina.cnAug 9, 2022
  8. rev-list: support human-readable output for `--disk-usage`Li Linchao via GitGitGadget, Aug 10, 2022
  9. Johannes SixtAug 10, 2022
  10. rev-list: support human-readable output for `--disk-usage`Li Linchao via GitGitGadget, Aug 10, 2022
  11. Junio C HamanoAug 10, 2022
  12. Jeff KingAug 10, 2022
  13. Junio C HamanoAug 10, 2022
  14. Junio C HamanoAug 11, 2022
  15. Jeff KingAug 11, 2022
  16. rev-list: support human-readable output for `--disk-usage`Li Linchao via GitGitGadget, Aug 11, 2022
  17. Junio C HamanoAug 11, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.