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

Re: Git packs friendly to block-level deduplication

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 24, 2018, 23:06 UTC
Message-ID
<878tcmyhyk.fsf@evledraar.gmail.com>
In-Reply-To
<CABPp-BE0u9x_TtEHmfS11ZV-50rSvCi_y7cmTVV7z=2zT3atvg@mail.gmail.com>
On Wed, Jan 24 2018, Elijah Newren jotted:
Show 27 quoted lines
> On Wed, Jan 24, 2018 at 2:03 PM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> If you have a bunch of git repositories cloned of the same project on
>> the same filesystem, it would be nice of the packs that are produced
>> would be friendly to block-level deduplication.
>>
>> This would save space, and the blocks would be more likely to be in
>> cache when you access them, likely speeding up git operations even if
>> the packing itself is less efficient.
>>
>> Here's a hacky one-liner that clones git/git and peff/git (almost the
>> same content) and md5sums each 4k packed block, and sort | uniq -c's
>> them to see how many are the same:
>
> <snip>
>
>>
>> Has anyone here barked up this tree before? Suggestions? Tips on where
>> to start hacking the repack code to accomplish this would be most
>> welcome.
>
> Does this overlap with the desire to have resumable clones?  I'm
> curious what would happen if you did the same experiment with two
> separate clones of git/git, cloned one right after the other so that
> hopefully the upstream git/git didn't receive any updates between your
> two separate clones.  (In other words, how much do packfiles differ in
> practice for different packings of the same data?)

If you clone git/git from Github twice in a row you get the exact same pack, and AFAICT this is true of git in general (but may change between versions).

If you make a local commit to that, copy the dir, and repack -A -d you get the exact same packs again.

If you then make just one local commit to one copy (even with --allow-empty) and repack, you get entirely differnt packs, in my test 2.5% of the blocks remain the same.

Obviously you could pack *that* new content incrementally and keep the existing pack, but that won't help you with de-duping the initially cloned data, which is what matters.

Previous: Elijah NewrenNext: Jeff King
Message 8 of 13 in “Git packs friendly to block-level deduplication”
  1. Ævar Arnfjörð BjarmasonJan 24, 2018
  2. Mike HommeyJan 24, 2018
  3. Junio C HamanoJan 24, 2018
  4. Mike HommeyJan 24, 2018
  5. Ævar Arnfjörð BjarmasonJan 24, 2018
  6. Eric WongJan 24, 2018
  7. Elijah NewrenJan 24, 2018
  8. Ævar Arnfjörð BjarmasonJan 24, 2018
  9. Jeff KingJan 24, 2018
  10. Jeff KingJan 24, 2018
  11. Ævar Arnfjörð BjarmasonJan 25, 2018
  12. Jeff KingJan 25, 2018
  13. Jeff KingJan 25, 2018

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.