From: "Mihai Capotă" <mihai@mihaic.ro>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH v2] count-objects: output "KiB" instead of "kilobytes"
Date: Wed, 3 Apr 2013 14:48:51 +0200 [thread overview]
Message-ID: <1364993331-20199-1-git-send-email-mihai@mihaic.ro> (raw)
In-Reply-To: <7vip44a8xl.fsf@alter.siamese.dyndns.org>
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
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 9afaa88..ecc13b0 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -124,7 +124,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
printf("garbage: %lu\n", garbage);
}
else
- printf("%lu objects, %lu kilobytes\n",
+ printf("%lu objects, %lu KiB\n",
loose, (unsigned long) (loose_size / 1024));
return 0;
}
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));
}
diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index 2fc5af6..37931d2 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -20,7 +20,7 @@ test_expect_success \
commit1=`git commit-tree $tree </dev/null` &&
git update-ref HEAD $commit1 &&
git repack -a -d &&
- test "`git count-objects`" = "0 objects, 0 kilobytes" &&
+ test "`git count-objects`" = "0 objects, 0 KiB" &&
pack1=`ls .git/objects/pack/*.pack` &&
test -f "$pack1"'
@@ -46,7 +46,7 @@ test_expect_success \
commit2=`git commit-tree $tree -p $commit1 </dev/null` &&
git update-ref HEAD $commit2 &&
git repack -a -d &&
- test "`git count-objects`" = "0 objects, 0 kilobytes" &&
+ test "`git count-objects`" = "0 objects, 0 KiB" &&
pack2=`ls .git/objects/pack/*.pack` &&
test -f "$pack2" &&
test "$pack1" \!= "$pack2"'
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh
index c47d450..e5cfd6a 100755
--- a/t/t5700-clone-reference.sh
+++ b/t/t5700-clone-reference.sh
@@ -46,7 +46,7 @@ cd "$base_dir"
test_expect_success 'that reference gets used' \
'cd C &&
-echo "0 objects, 0 kilobytes" > expected &&
+echo "0 objects, 0 KiB" > expected &&
git count-objects > current &&
test_cmp expected current'
@@ -73,7 +73,7 @@ test_expect_success 'pulling from reference' \
cd "$base_dir"
test_expect_success 'that reference gets used' \
-'cd D && echo "0 objects, 0 kilobytes" > expected &&
+'cd D && echo "0 objects, 0 KiB" > expected &&
git count-objects > current &&
test_cmp expected current'
diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index b770b2f..aeface6 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -49,7 +49,7 @@ cd "$base_dir"
test_expect_success 'that reference gets used with add' \
'cd super/sub &&
-echo "0 objects, 0 kilobytes" > expected &&
+echo "0 objects, 0 KiB" > expected &&
git count-objects > current &&
diff expected current'
@@ -72,7 +72,7 @@ cd "$base_dir"
test_expect_success 'that reference gets used with update' \
'cd super-clone/sub &&
-echo "0 objects, 0 kilobytes" > expected &&
+echo "0 objects, 0 KiB" > expected &&
git count-objects > current &&
diff expected current'
--
1.7.9.5
next prev parent reply other threads:[~2013-04-03 12:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 11:43 [PATCH] count-objects: output "KiB" instead of "kilobytes" Mihai Capotă
2013-04-02 17:41 ` Junio C Hamano
2013-04-02 22:01 ` Junio C Hamano
2013-04-03 6:27 ` Mihai Capotă
2013-04-03 12:48 ` Mihai Capotă [this message]
2013-04-03 14:38 ` [PATCH v2] " Junio C Hamano
2013-04-04 13:18 ` Mihai Capotă
2013-04-04 16:27 ` Junio C Hamano
2013-04-05 9:38 ` Mihai Capotă
2013-04-05 9:39 ` [PATCH] count-objects doc: document use of kibibytes Mihai Capotă
2013-04-05 20:31 ` [PATCH v2] count-objects: output "KiB" instead of "kilobytes" Antoine Pelisse
2013-04-08 18:18 ` [PATCH 1/2] progress: create public humanize() to show sizes Antoine Pelisse
2013-04-08 18:18 ` [PATCH 2/2] count-objects: add -H option to humanize sizes Antoine Pelisse
2013-04-08 21:40 ` [PATCH 1/2] progress: create public humanize() to show sizes Junio C Hamano
2013-04-10 19:03 ` [PATCH 1/2] strbuf: create strbuf_humanize() to show byte sizes Antoine Pelisse
2013-04-10 19:03 ` [PATCH 2/2] count-objects: add -H option to humanize sizes Antoine Pelisse
2013-04-10 19:43 ` [PATCH 1/2] strbuf: create strbuf_humanize() to show byte sizes Jonathan Nieder
2013-04-10 20:00 ` Antoine Pelisse
2013-04-10 19:57 ` Junio C Hamano
2013-04-10 20:12 ` Antoine Pelisse
2013-04-08 21:55 ` [PATCH 1/2] progress: create public humanize() to show sizes Eric Sunshine
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1364993331-20199-1-git-send-email-mihai@mihaic.ro \
--to=mihai@mihaic.ro \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
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 NNTP newsgroup(s).