Re: Questions about git-push for huge repositories
- From
- Levin Du <zslevin@gmail.com>
- Date
- Sep 8, 2015, 01:30 UTC
- Message-ID
- <CAN6cQGOO540FV9bTQPks+1nHS1xO10Rv8iNzAj8-cBihQ4_kEw@mail.gmail.com>
- In-Reply-To
- <CAN6cQGNGP+n3L=tuRCymOTWFCnFNsq-tFHkaNm+W=o726mjmmw@mail.gmail.com>
I consider 'git push' need further optimization.
Take kernel source code for example:
# Clone the kernel to A and B $ git --version git version 2.3.2 $ git clone --bare ../kernel/ A $ git clone --bare ../kernel/ B
# Create the orphan commit and check $ cd A $ git branch test Switched to a new branch 'test' $ git replace --graft test $ git rev-parse test cbbae6741c60c9e09f87521e3a79810abd6a2fda $ git rev-parse test^{tree} 929bdce0b48ca6079ad281a9d8ba24de3e49881a $ git rev-parse replace/cbbae6741c60c9e09f87521e3a79810abd6a2fda 82d3e9ce1ca062c219f1209c5291ccd5603e5302 $ git rev-parse 82d3e9ce1ca062c219f1209c5291ccd5603e5302^{tree} 929bdce0b48ca6079ad281a9d8ba24de3e49881a $ git log --pretty=oneline 82d3e9ce1ca062c219f1209c5291ccd5603e5302 | wc -l 1
We can see that commit 82d3e9ce1ca062c219f1209c5291ccd5603e5302 (root commit) is meant to replace for commit cbbae6741c60c9e09f87521e3a79810abd6a2fda . They both contain the same tree 929bdce0b48ca6079ad281a9d8ba24de3e49881a .
$ du -hs ../B 1.6G ../B $ git push ../B 'refs/replace/*' Counting objects: 51216, done. Delta compression using up to 8 threads. Compressing objects: 100% (48963/48963), done. Writing objects: 100% (51216/51216), 139.61 MiB | 17.88 MiB/s, done. Total 51216 (delta 3647), reused 34580 (delta 1641) To ../B * [new branch] refs/replace/cbbae6741c60c9e09f87521e3a79810abd6a2fda -> refs/replace/cbbae6741c60c9e09f87521e3a79810abd6a2fda $ du -hs ../B 1.7G ../B
It takes some time for 'git push' to compress the objects and B has finally increased 0.1G, which is for the newly commit whose tree is already in the repository.