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

Re: [PATCH v2 3/3] count-objects: add human-readable size option

From
Petr Baudis <pasky@suse.cz>
Date
Aug 14, 2008, 22:37 UTC
Message-ID
<20080814223740.GD10544@machine.or.cz>
In-Reply-To
<1218752308-3173-4-git-send-email-marcus@griep.us>
On Thu, Aug 14, 2008 at 06:18:28PM -0400, Marcus Griep wrote:
Show 18 quoted lines
> @@ -21,9 +21,14 @@ OPTIONS
>  --verbose::
>  	In addition to the number of loose objects and disk
>  	space consumed, it reports the number of in-pack
> -	objects, number of packs, and number of objects that can be
> -	removed by running `git prune-packed`.
> -
> +	objects, number of packs, disk space consumed by those packs
> +	and number of objects that can be removed by running
> +	`git prune-packed`.
> +
> +-H::
> +--human-sizes::
> +	Displays sizes reported by `--verbose` in a more
> +	human-readable format. (e.g. 22M or 1.5G)
>  
>  Author
>  ------
Can you guess what would I bug you about? ;-)
Show 11 quoted lines
> -		printf("size-pack: %lu\n", size_pack / 1024);
> +		printf("size-pack: ");
> +		if (human_readable) {
> +			struct strbuf sb;
> +			strbuf_init(&sb, 0);
> +			strbuf_append_human_readable(&sb, size_pack,
> +							0, 0, "", 0);
> +			printf("%s\n", sb.buf);
> +		}
> +		else
> +			printf("%lu\n", size_pack / 1024);

If it's non-human-readable anyway, why are you dividing this by 1024? At any rate, it is not obvious at all that the size-pack is not actually size-pack but size-pack/1024. You should either add the (fixed) unit string behind or name it size-pack-kb - or just not divide it at all?

This also applies to PATCH1/3 in case it would get applied but the other two wouldn't.

-- 
				Petr "Pasky" Baudis
The next generation of interesting software will be done
on the Macintosh, not the IBM PC.  -- Bill Gates
Previous: Marcus GriepNext: Marcus Griep
Message 5 of 18 in “count-objects size and strbuf human-readable”
  1. 0/3 count-objects size and strbuf human-readableMarcus Griep, Aug 14, 2008
  2. 1/3 count-objects: Add total pack size to verbose outputMarcus Griep, Aug 14, 2008
  3. 2/3 strbuf: Add method to convert byte-size to human readable formMarcus Griep, Aug 14, 2008
  4. 3/3 count-objects: add human-readable size optionMarcus Griep, Aug 14, 2008
  5. Petr BaudisAug 14, 2008
  6. Marcus GriepAug 14, 2008
  7. Junio C HamanoAug 15, 2008
  8. Petr BaudisAug 14, 2008
  9. Junio C HamanoAug 14, 2008
  10. Petr BaudisAug 14, 2008
  11. Junio C HamanoAug 14, 2008
  12. Marcus GriepAug 15, 2008
  13. Marcus GriepAug 15, 2008
  14. Shawn O. PearceAug 15, 2008
  15. 1/3 count-objects: Add total pack size to verbose outputMarcus Griep, Aug 15, 2008
  16. 2/3 strbuf: Add method to convert byte-size to human readable formMarcus Griep, Aug 15, 2008
  17. 3/3 count-objects: add human-readable size optionMarcus Griep, Aug 15, 2008
  18. 1/3 count-objects: Add total pack size to verbose outputMarcus Griep, Aug 15, 2008

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.