weird "du" sizes when cloning a local repo

Mads Kiilerich mads at kiilerich.com
Tue Oct 6 10:24:10 CDT 2009


On 10/06/2009 05:14 PM, Robert P. J. Day wrote:
>
>    (aside:  i'm just getting into mercurial and am working my way thru
> the book, so i'm hoping this is the right place to ask relatively
> newbie-level questions, and be corrected on my abuse of terminology.)
>
>    on p. 15 of the o'sullivan book, there's a simple example of cloning
> the demonstration "hello" checkout, after which i wanted to verify
> that the two checkouts were approximately the same in terms of space
> usage:
>
> $ hg clone hello my-hello
> updating working directory
> 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
> [rpjday at localhost test]$ du -s *
> 76	hello
> 40	my-hello
> $

Try to compare with the output of "du -s my-hello hello".

And try with "du -s --count-links hello my-hello"

>    ok, that strikes me as strange ... why would the clone take up so
> much less space?  let's examine further:
>
> $ cd my-hello
> $ ls -a
> .  ..  hello.c  .hg  Makefile
> $ du -s .hg
> 56	.hg
> $
>
>    now i'm just baffled.  how could the entire "my-hello" directory be
> listed as taking 40K, when the .hg directory along is displayed as
> taking 56?  this is probably a "du" issue, not really mercurial, but
> i'm just confused by the above.
>
>    what *should* the comparative sizes be?  i would have thought
> identical, or nearly so.

hg clone uses hardlinks, and du by default only reports hardlinks once.

/Mads


More information about the Mercurial mailing list