7

I want to check the total size of a git repository. Is funny that du is giving me two different kind of sizes when the -h flag is sent. It is actually giving double size.

Why is this? What is the correct size?

MyMac:~/repositories/my-repo.git davidrod$ du -h
  0B    ./branches
 64K    ./hooks
4.0K    ./info
  0B    ./objects/info
3.3M    ./objects/pack
3.3M    ./objects
4.0K    ./refs/heads
8.0K    ./refs/tags
 12K    ./refs
3.3M    .
MyMac:~/repositories/my-repo.git davidrod$ du 
0   ./branches
128 ./hooks
8   ./info
0   ./objects/info
6672    ./objects/pack
6672    ./objects
8   ./refs/heads
16  ./refs/tags
24  ./refs
6856    .
4

2 回答 2

9

OSX 上的大小(我假设您从计算机名称中获得)是基于 512 字节块计算的,因为使用的是 BSD 版本du(其他版本,如我现在在 Windows 上使用的 Cygwin 的版本,行为不同)。

所以每 1K 你得到两个块,显然每个大小的值加倍。

于 2014-05-11T23:55:14.967 回答
4

他们都是正确的。在第二种情况下,单位是块(每个512B)。1 KB = 2 个块。

于 2014-05-11T23:54:52.790 回答