Subject: Re: [PATCH] Avoid using dc in git-count-objects

From: Andreas Ericsson <[email-masked]>
Date: Wed, 26 Oct 2005 16:55:32 +0200

Johannes Schindelin wrote:
> Hi,
> 
> On Wed, 26 Oct 2005, Andreas Ericsson wrote:
> 
> 
>>I'd be more worried about the fact that the kilobytes count is way off 
>>as it is. du (at least from coreutils-5.2.1) rounds up to nearest 
>>kilobyte *for each file* when printing kb-count.
> 
> 
> The rationale behind this: You want to know how much space it takes on 
> your hard disk. Remember, git-count-objects should give you a clue whether 
> to repack or not.
> 

Oh. I thought it was so I would know how much data would be sent over 
the network. Diskspace is cheap, bandwidth is... well, that's cheap too 
(in Sweden at least), but it's boring to wait.

> Actually, "du -k" in my tests rounds up to nearest block size or kilobytes 
> (whichever is greater): For example, "du -k" on a very small file (53 
> bytes) says "1" on an ext2fs yields "1", "4" on hfs, and 32 on a big 
> FAT32. Of course, you may get different values, since the block sizes 
> sometimes depend on the total size of the media.
> 

 From my du man-page:

  -k     like --block-size=1K

I think *most* du implementations work like this, but apparently not all 
of them. I'll hack something up in C instead so it's at least consistent 
regardless of what version of du is used.

-- 
Andreas Ericsson                   [email-masked]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231