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

Re: Questions about git-push for huge repositories

From
LDLevin 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.

Previous: Levin DuNext: Jeff King
Message 5 of 9 in “Questions about git-push for huge repositories”
  1. Levin DuSep 6, 2015
  2. Junio C HamanoSep 6, 2015
  3. Levin DuSep 7, 2015
  4. Levin DuSep 7, 2015
  5. Levin DuSep 8, 2015
  6. Jeff KingSep 8, 2015
  7. Junio C HamanoSep 8, 2015
  8. Jeff KingSep 8, 2015
  9. Jeff KingSep 8, 2015

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.