4 ms·
You can see git's DAG as a dedup'd Merkle tree: in other words, if two child pointers in two places in the tree point to nodes (blobs) with the same hash, make
by cfallin 11y ago
You can see git's DAG as a dedup'd Merkle tree: in other words, if two child pointers in two places in the tree point to nodes (blobs) with the same hash, make them share a single node instead.
This works because the hash "is" the content/entire subtree (modulo hash collisions), so the resulting data structure has the same meaning as before.
Content/hash-addressed stores are related to referential transparency and immutability (and deep equality) in languages like Haskell, FWIW. I've always thought it's sort of beautiful how cleanly the ideas come together like that.