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

Re: [PATCH v2] count-objects: output "KiB" instead of "kilobytes"

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 3, 2013, 14:38 UTC
Message-ID
<7vd2ub7k7c.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1364993331-20199-1-git-send-email-mihai@mihaic.ro>
Mihai Capotă <mihai@mihaic.ro> writes:
Show 38 quoted lines
> The code uses division by 1024. The master branch count-objects manual also
> uses "KiB".
>
> Also updated the code that reads count-objects output (t5301, t5700, t7408, and
> git-cvsimport) and the Git User's Manual.
>
> Signed-off-by: Mihai Capotă <mihai@mihaic.ro>
> ---
>  Documentation/user-manual.txt  |    4 ++--
>  builtin/count-objects.c        |    2 +-
>  git-cvsimport.perl             |    8 ++++----
>  t/t5301-sliding-window.sh      |    4 ++--
>  t/t5700-clone-reference.sh     |    4 ++--
>  t/t7408-submodule-reference.sh |    4 ++--
>  6 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
> index e831cc2..b61a09c 100644
> --- a/Documentation/user-manual.txt
> +++ b/Documentation/user-manual.txt
> @@ -3175,7 +3175,7 @@ lot of objects.  Try this on an old project:
>  
>  ------------------------------------------------
>  $ git count-objects
> -6930 objects, 47620 kilobytes
> +6930 objects, 47620 KiB
>  ------------------------------------------------
>  
>  The first number is the number of objects which are kept in
> @@ -3215,7 +3215,7 @@ You can verify that the loose objects are gone by looking at the
>  
>  ------------------------------------------------
>  $ git count-objects
> -0 objects, 0 kilobytes
> +0 objects, 0 KiB
>  ------------------------------------------------
>  
>  Although the object files are gone, any commands that refer to those

It is good to see the patch being thorough, adjusting even documentation.

Show 20 quoted lines
> diff --git a/git-cvsimport.perl b/git-cvsimport.perl
> index 73d367c..de44e33 100755
> --- a/git-cvsimport.perl
> +++ b/git-cvsimport.perl
> @@ -1126,12 +1126,12 @@ unless ($opt_P) {
>  }
>  
>  # The heuristic of repacking every 1024 commits can leave a
> -# lot of unpacked data.  If there is more than 1MB worth of
> +# lot of unpacked data.  If there is more than 1MiB worth of
>  # not-packed objects, repack once more.
>  my $line = `git count-objects`;
> -if ($line =~ /^(\d+) objects, (\d+) kilobytes$/) {
> -  my ($n_objects, $kb) = ($1, $2);
> -  1024 < $kb
> +if ($line =~ /^(\d+) objects, (\d+) KiB$/) {
> +  my ($n_objects, $kib) = ($1, $2);
> +  1024 < $kib
>      and system(qw(git repack -a -d));
>  }

This hunk makes me wonder if this s/kilobytes/kib/ is a good idea in the first place. This in-tree user was lucky enough to have been caught and adjusted, but we don't know how many out-of-tree scripts are broken the same way and in need of a similar treatment.

Previous: Mihai CapotăNext: Mihai Capotă
Message 6 of 21 in “count-objects: output "KiB" instead of "kilobytes"”
  1. count-objects: output "KiB" instead of "kilobytes"Mihai Capotă, Apr 2, 2013
  2. Junio C HamanoApr 2, 2013
  3. Junio C HamanoApr 2, 2013
  4. Mihai CapotăApr 3, 2013
  5. count-objects: output "KiB" instead of "kilobytes"Mihai Capotă, Apr 3, 2013
  6. Junio C HamanoApr 3, 2013
  7. Mihai CapotăApr 4, 2013
  8. Junio C HamanoApr 4, 2013
  9. Mihai CapotăApr 5, 2013
  10. count-objects doc: document use of kibibytesMihai Capotă, Apr 5, 2013
  11. Antoine PelisseApr 5, 2013
  12. 1/2 progress: create public humanize() to show sizesAntoine Pelisse, Apr 8, 2013
  13. 2/2 count-objects: add -H option to humanize sizesAntoine Pelisse, Apr 8, 2013
  14. Junio C HamanoApr 8, 2013
  15. 1/2 strbuf: create strbuf_humanize() to show byte sizesAntoine Pelisse, Apr 10, 2013
  16. 2/2 count-objects: add -H option to humanize sizesAntoine Pelisse, Apr 10, 2013
  17. Jonathan NiederApr 10, 2013
  18. Antoine PelisseApr 10, 2013
  19. Junio C HamanoApr 10, 2013
  20. Antoine PelisseApr 10, 2013
  21. Eric SunshineApr 8, 2013

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.