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

Re: Git as a filesystem

From
Sam Vilain <sam@vilain.net>
Date
Sep 22, 2007, 03:09 UTC
Message-ID
<46F4874D.8000305@vilain.net>
In-Reply-To
<46a038f90709211656n5b23783eu330e8b655cd42aa8@mail.gmail.com>
Martin Langhoff wrote:
Show 22 quoted lines
> On 9/22/07, Dmitry Potapov <dpotapov@gmail.com> wrote:
>   
>> used to create the original file. So, if you put any .deb file in such
>> a system, you will get back a different .deb file (with a different SHA1).
>> So, aside high CPU and memory requirements, this system cannot work in
>> principle unless all users have exactly the same version of a compressor.
>>     
>
> Was thinking the same - compression machinery, ordering of the files,
> everything. It'd be a nightmare to ensure you get back the same .deb,
> without a single different bit.
>
> Debian packaging toolchain could be reworked to use a more GIT-like
> approach - off the top of my head, at least
>
>   - signing/validating the "tree" of the package rather than the
> completed package could allow the savings in distribution you mention,
> decouple the signing from the compression, and simplify things like
> debdiff
>
>   - git or git-like strategies for source packages
>   

Nightmare indeed. I actually wrote a proof of concept for this idea for gzip.

http://git.catalyst.net.nz/gw?p=git.git;a=shortlog;h=archive-blobs (see also http://planet.catalyst.net.nz/blog/2006/07/17/samv/xteddy_caught_consuming_rampant_amounts_of_disk_space)

I usually warn people that this undertaking is "slightly insane".

My implementation was designed to be called like "git-hash-object". What it did was look at the input stream, and detect quickly whether it looked like a gzip stream. If it was, it would decompress it and then try to compress the first few blocks using different compression libraries and settings to determine what settings were used. If it could find the right settings for the first meg or so, then it would bank on the rest being identical as well, record which compressor and what settings were used and write the uncompressed object, as well as the information needed to reconstruct the gzip header, to a new type of object called an "archive" object. If the stream could not be reproduced then it would save the raw stream instead. For something like a Debian archive, it is very likely that all compressed streams will be reproducible, because they will almost all be compressed using the same implementation of gzip.

For tar and .ar files, this can be slightly more deterministic of course. It doesn't even need to be particularly savvy of what all the fields are - just locate the files in the .tar, write out a tree, and then write a TOC that lists tree entries and contains any extra data (ie headers, etc).

In hindsight, making a new object type was probably a mistake. If I were to re-undertake this I would not go down that path, though I'd certainly consider using tag objects for the extra data, and throwing them in the tree like submodules. It would also be essential in a "real" solution to bundle reference copies of the zlib and gzip compressors (yes, their output streams differ with longer inputs and even some short ones).

Sam.
Previous: Martin LanghoffNext: Nicolas Pitre
Message 10 of 19 in “Git as a filesystem”
  1. Peter StahlirSep 21, 2007
  2. Johannes SchindelinSep 21, 2007
  3. Peter StahlirSep 21, 2007
  4. Karl HasselströmSep 21, 2007
  5. Peter StahlirSep 21, 2007
  6. Michael PooleSep 21, 2007
  7. jlhSep 21, 2007
  8. Dmitry PotapovSep 21, 2007
  9. Martin LanghoffSep 21, 2007
  10. Sam VilainSep 22, 2007
  11. Nicolas PitreSep 21, 2007
  12. Peter StahlirSep 21, 2007
  13. Nicolas PitreSep 21, 2007
  14. Christian von KietzellSep 21, 2007
  15. Eric WongSep 21, 2007
  16. Johannes SchindelinSep 21, 2007
  17. Eric WongSep 22, 2007
  18. Johannes SchindelinSep 22, 2007
  19. Miklos VajnaSep 21, 2007

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.