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

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

From
Andreas Ericsson <ae@op5.se>
Date
Oct 26, 2005, 14:55 UTC
Message-ID
<435F98E4.8040301@op5.se>
In-Reply-To
<Pine.LNX.4.63.0510261637070.26622@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin wrote:
Show 14 quoted lines
> 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.

Show 6 quoted lines
> 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                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Johannes Schindelin
Message 18 of 18 in “Avoid using dc in git-count-objects”
  1. Avoid using dc in git-count-objectsJohannes Schindelin, Oct 25, 2005
  2. Junio C HamanoOct 26, 2005
  3. Johannes SchindelinOct 26, 2005
  4. Petr BaudisOct 26, 2005
  5. Matthias UrlichsOct 27, 2005
  6. Johannes SchindelinOct 27, 2005
  7. Linus TorvaldsOct 27, 2005
  8. Junio C HamanoOct 27, 2005
  9. Herbert XuOct 28, 2005
  10. H. Peter AnvinOct 28, 2005
  11. Herbert XuOct 28, 2005
  12. H. Peter AnvinOct 28, 2005
  13. Herbert XuOct 28, 2005
  14. H. Peter AnvinOct 28, 2005
  15. Johannes SchindelinOct 26, 2005
  16. Andreas EricssonOct 26, 2005
  17. Johannes SchindelinOct 26, 2005
  18. Andreas EricssonOct 26, 2005

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.