3 ms·
Copy-on-write is an implementation detail that allows for lower storage. The snapshot is still the full copy. One could try to argue that the same is true for g
by throwaway894345 6y ago
Copy-on-write is an implementation detail that allows for lower storage. The snapshot is still the full copy. One could try to argue that the same is true for git in that diffs (or content addressable storage) are just an internal implementation detail, but as the parent pointed out that's not quite true--our commits document the diff, not the materialized snapshot.
- nybble41 6y ago> our commits document the diff, not the materialized snapshot That's not actually true, though. This is what a raw commit object looks like: $ git cat-file commit bfc766d38e1fae5767d43845c15c79ac8fa6d6af tree 99768f8965d5382d1c1695c371a854d061f2548b parent 860a3b34854d8abe9af9f1eb584691de926ce897 author Peter Maydell <peter.maydell@linaro.org> 1462981466 +0100 committer Peter Maydell <peter.maydell@linaro.org> 1462981466 +0100 Update version for v2.6.0 release Signed-off-by: Peter Maydell <peter.maydell@linaro.org> (This commit is from the QEMU project repository.) Note that there is no reference to a diff. There is a reference to a tree, which is a binary object representing a directory structure—a full snapshot of the state of the working tree as of that commit: $ git ls-tree 99768f8965d5382d1c1695c371a854d061f2548b 100644 blob 3ac0cfc6f0d60a95a5c3557497835c80e52a1696 .dir-locals.el 100644 blob 37755ede83a0d5b4fe22114f624a140d2bcaefff .exrc 100644 blob 88a80ff4a5c552bad3bc2bf40b1fc4a45c57a177 .gitignore 100644 blob 9da9ede26161bc5c6f12552b55bc54f55bb1e839 .gitmodules … Each of those blobs is a reference to the full content of the corresponding file: $ git cat-file blob 3ac0cfc6f0d60a95a5c3557497835c80e52a1696 # .dir-locals.el ((c-mode . ((c-file-style . "stroustrup") (indent-tabs-mode . nil)))) For storage purposes there is deduplication, delta encoding, and compression going on behind the scenes, so committing a 100M working tree with a few small changes doesn't take up 100M of additional storage space, but these are invisible to the upper layer. When Git needs a diff, for example to perform a three-way merge, or in response to `git show` command, it generates one on the fly from the snapshots.
- throwaway894345 6y agoApologies for the typo, I meant to say “...commit messages document...”