summaryrefslogtreecommitdiff
path: root/builtin-count-objects.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2009-12-29 19:09:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-12-30 03:51:37 (GMT)
commitc985ddf318a8c41c6e1abc8bebd058b31c7413c1 (patch)
treeed7352463f586831950d33a1220613762d450958 /builtin-count-objects.c
parent66fd74ea5db13e6f095f7c414e9ea4a1aa59cdc7 (diff)
downloadgit-c985ddf318a8c41c6e1abc8bebd058b31c7413c1.zip
git-c985ddf318a8c41c6e1abc8bebd058b31c7413c1.tar.gz
git-c985ddf318a8c41c6e1abc8bebd058b31c7413c1.tar.bz2
git count-objects: handle packs bigger than 4G
Use off_t to count sizes of packs and objects to avoid overflow after 4Gb. Signed-off-by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-count-objects.c')
-rw-r--r--builtin-count-objects.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin-count-objects.c b/builtin-count-objects.c
index 38b033f..80b2614 100644
--- a/builtin-count-objects.c
+++ b/builtin-count-objects.c
@@ -10,7 +10,7 @@
static void count_objects(DIR *d, char *path, int len, int verbose,
unsigned long *loose,
- unsigned long *loose_size,
+ off_t *loose_size,
unsigned long *packed_loose,
unsigned long *garbage)
{
@@ -78,7 +78,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
int len = strlen(objdir);
char *path = xmalloc(len + 50);
unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0;
- unsigned long loose_size = 0;
+ off_t loose_size = 0;
struct option opts[] = {
OPT__VERBOSE(&verbose),
OPT_END(),
@@ -104,7 +104,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
if (verbose) {
struct packed_git *p;
unsigned long num_pack = 0;
- unsigned long size_pack = 0;
+ off_t size_pack = 0;
if (!packed_git)
prepare_packed_git();
for (p = packed_git; p; p = p->next) {
@@ -117,15 +117,15 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
num_pack++;
}
printf("count: %lu\n", loose);
- printf("size: %lu\n", loose_size / 1024);
+ printf("size: %lu\n", (unsigned long) (loose_size / 1024));
printf("in-pack: %lu\n", packed);
printf("packs: %lu\n", num_pack);
- printf("size-pack: %lu\n", size_pack / 1024);
+ printf("size-pack: %lu\n", (unsigned long) (size_pack / 1024));
printf("prune-packable: %lu\n", packed_loose);
printf("garbage: %lu\n", garbage);
}
else
printf("%lu objects, %lu kilobytes\n",
- loose, loose_size / 1024);
+ loose, (unsigned long) (loose_size / 1024));
return 0;
}