{"thread":{"id":"15726","subject":"How Blobs Work ( Blobs Vs. Deltas)","startedAt":"2008-09-30T15:14:06Z","lastAt":"2008-09-30T18:54:21Z","messageCount":4,"participants":["Feanil Patel","Bruce Stephens","Johannes Sixt","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"91953","messageId":"16946e800809300814v134a42dft37becdbd8aa7669a@mail.gmail.com","threadId":"15726","inReplyTo":null,"subject":"How Blobs Work ( Blobs Vs. Deltas)","fromName":"Feanil Patel","fromEmail":"feanil@gmail.com","sentAt":"2008-09-30T15:14:06Z","receivedAt":"2008-09-30T15:14:06Z","isPatch":false,"sender":{"key":"feanil@gmail.com","avatar":"https://gravatar.com/avatar/699979df6ea477a4bef95fa8595768623598afc6f0ba7f939015c3cf5cfc700c?d=mp&s=160"},"body":"Hello,\n\nI was reading about git objects on The Git\nBook(http://book.git-scm.com/1_the_git_object_model.html) which was\nposted on the mailing list a while back and I was wondering something\nabout blobs and how files are stored in any particular version.  If\nfile A is changed from version one to version two there are two\ndifferent blobs that exist for the two versions of the file, is that\ncorrect?  The Book was saying Git does not use delta storage so does\nthis mean that there are two almost identical copies of the file with\nthe difference being the change that was put in from version one to\nversion two?\n\n-Feanil\n"},{"id":"91955","messageId":"80vdwd64bu.fsf@tiny.isode.net","threadId":"15726","inReplyTo":"16946e800809300814v134a42dft37becdbd8aa7669a@mail.gmail.com","subject":"Re: How Blobs Work ( Blobs Vs. Deltas)","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2008-09-30T15:28:21Z","receivedAt":"2008-09-30T15:28:21Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"\"Feanil Patel\" <feanil@gmail.com> writes:\n\n> I was reading about git objects on The Git\n> Book(http://book.git-scm.com/1_the_git_object_model.html) which was\n> posted on the mailing list a while back and I was wondering something\n> about blobs and how files are stored in any particular version.\n\n[...]\n\n> The Book was saying Git does not use delta storage so does this mean\n> that there are two almost identical copies of the file with the\n> difference being the change that was put in from version one to\n> version two?\n\nThere might be.  git may also end up using deltas, see\n<http://book.git-scm.com/7_the_packfile.html>.\n"},{"id":"91956","messageId":"48E245C4.7030003@viscovery.net","threadId":"15726","inReplyTo":"16946e800809300814v134a42dft37becdbd8aa7669a@mail.gmail.com","subject":"Re: How Blobs Work ( Blobs Vs. Deltas)","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-09-30T15:29:08Z","receivedAt":"2008-09-30T15:29:08Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Feanil Patel schrieb:\n> I was reading about git objects on The Git\n> Book(http://book.git-scm.com/1_the_git_object_model.html) which was\n> posted on the mailing list a while back and I was wondering something\n> about blobs and how files are stored in any particular version.  If\n> file A is changed from version one to version two there are two\n> different blobs that exist for the two versions of the file, is that\n> correct?  The Book was saying Git does not use delta storage so does\n> this mean that there are two almost identical copies of the file with\n> the difference being the change that was put in from version one to\n> version two?\n\nAt the conceptual level, yes. An entire file (== blob) is the smallest\nunit that you can address. Even git's internals do not work with smaller\nunits.\n\nBut there is, of course, a mechanism that stores the database in a more\ncompact format, the so-called pack files, that basically store differences\nbetween files as much as possible.\n\n-- Hannes\n"},{"id":"91969","messageId":"m3y719qxc9.fsf@localhost.localdomain","threadId":"15726","inReplyTo":"16946e800809300814v134a42dft37becdbd8aa7669a@mail.gmail.com","subject":"Re: How Blobs Work ( Blobs Vs. Deltas)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-09-30T18:54:21Z","receivedAt":"2008-09-30T18:54:21Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Feanil Patel\" <feanil@gmail.com> writes:\n\n> Hello,\n> \n> I was reading about git objects in \"The Git Community Book\"\n> (http://book.git-scm.com/1_the_git_object_model.html), which was\n> posted on the mailing list a while back, and I was wondering something\n> about blobs and how files are stored in any particular version.  If\n> file A is changed from version one to version two there are two\n> different blobs that exist for the two versions of the file, is that\n> correct?  The Book was saying Git does not use delta storage so does\n> this mean that there are two almost identical copies of the file with\n> the difference being the change that was put in from version one to\n> version two?\n\nIn Git there are two kinds of storage: loose objects and packs. Each\nobject generally starts as a loose object; for those it is like you\nwrote: if you have two versions of some file, you would have both\nof those contents of a file stored as separate objects (blobs).  Note\nthat those 'blob' objects are compressed, so they usually don't take\nmore time than current version of file and its backup.\n\nBut there exists also other type of storage, namely packed.  In the\npast you had to pack (repack) objects by invoking \"git repack\" and\n\"git prune\", and in more modern times by calling \"git gc\"; nowadays\nthis should be taken care of by git using \"git gc --auto\" behind.\nWhen packing git tries to find objects which are close contents,\nand store them as base object and binary delta (based on LibXDiff).\nSo you get benefits of delta storage, while on the API and script\nlevel you always see single objects.\n\nNote that explicit repacking allow git to not only consider versions\nof the same file to diff against, tree and not only linear chains of\ndeltas (think branches), and while recency order is preferred it is\nnot enforced; objects and deltas are then compressed individually.\n\nHTH\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}