Solved How much HDD space do I need to Git clone main (deep vs. shallow)

Code:
% du -sh /usr/src/
2.2G    /usr/src/
That's been a "plain" git checkout of stable/13:
Code:
dice@molly:/usr/src % git remote -v
origin  https://git.freebsd.org/src.git (fetch)
origin  https://git.freebsd.org/src.git (push)
dice@molly:/usr/src % git branch
* stable/13
 
  • Thanks
Reactions: a6h
Shallow clone of releng/13.0:
Code:
984M    /usr/src

NAME                PROPERTY       VALUE           SOURCE
sys/ROOT/R13.0/src  used           962M            -
sys/ROOT/R13.0/src  logicalused    1.43G           -
sys/ROOT/R13.0/src  compression    lz4             local
sys/ROOT/R13.0/src  compressratio  1.76x           -
 
  • Thanks
Reactions: a6h
Thanks SirDice and mickey. So it's very close to the SVN. That's good news, because I'm short on storage and have limited bandwidth.
I hope somebody post a "du" of "Deep Clone" too -- for CURRENT and STABLE.

Initially I wanted to go with "Deep" -- to have a complete working clone, as I was doing with SVN (base/head and base/stable/12)
But from what I've learned from different blogs, it sounds like it will download the whole repo! or at least it's far larger than SVN.
 
Did a git checkout of releng/13.0 and main, next to the existing stable/13, size shouldn't differ that much:
Code:
root@molly:/usr/src # git branch
  main
  releng/13.0
* stable/13
root@molly:/usr/src # du -sh /usr/src/
2.2G    /usr/src/
So if you have about 2.5G to spare you should be fine switching between the different branches, that'll leave some room for future growth too. Also note that you can safely enable compression if you have it on a ZFS dataset. As it's all text it should compress quite nicely.
 
  • Thanks
Reactions: a6h
I hope somebody post a "du" of "Deep Clone" too -- for CURRENT and STABLE.
Unless you use --single-branch, this is no difference. The standard approach is to clone the full repo.

Compared to SVN, GIT is pretty space-efficient. The first here is my current full clone of src.git (including all branches, with releng/13.0 currently checked out). The second is my old SVN working copy of only releng/12.2:
Code:
vmhost# du -sh /var/jail/builder/src
2.2G    /var/jail/builder/src
vmhost# du -sh /var/jail/builder/src/.zfs/snapshot/backup-20201222-141752     
2.6G    /var/jail/builder/src/.zfs/snapshot/backup-20201222-141752
 
  • Thanks
Reactions: a6h
A default auto-installed ZFS already sets up compression on /usr/ports and /usr/src. But if you have your ports or source tree on a different pool for example you're going to need to enable it yourself.
 
  • Thanks
Reactions: a6h
Back
Top