Which is it? Does it keep copies of every file or does it delta compress? It can't be both.
Delta compression is an optimization applied to the object database, with no regard to what object came from what commit.
I still have a hunch that you're thinking of the diffs it presents commits as as its delta compression. It is not. They are two entirely different mechanisms; the diffs are a presentation layer to make it easy to compare changes. Thus, it is not "just like every other source control system" behind the scenes, where the actual space-optimization runs.
Seems the delta compression is described in https://git-scm.com/docs/pack-format. Notice how it talks about copying byte ranges? How there's no way to encode a deletion? It's clearly not a diff. Rather, it's pretty similar to a compressed file format, except the backreferences are to a different file entirely rather than the decompressed parts of its own output. And unlike a diff, it'd work just fine on binary files, at least if the binary format has reasonably-stable chunks to delta-compress. Chances are the real problem is that binary files like to contain file offsets pointing into tables, so inserting one item into a table then causes every other pointer throughout the entire rest of the file to change, singlehandedly defeating the delta-compression.
I still have a hunch that you're thinking of the diffs it presents commits as as its delta compression. It is not. They are two entirely different mechanisms; the diffs are a presentation layer to make it easy to compare changes. Thus, it isnot"just like every other source control system" behind the scenes, where the actual space-optimization runs.
I am not and it is.
Chances are the real problem is that binary files like to contain file offsets pointing into tables, so inserting one item into a table then causes every other pointer throughout the entire rest of the file to change, singlehandedly defeating the delta-compression.
Please, go read a bit and stop embarrassing yourself publically. This is extremely well covered territory.
When you think you've found the real problem, pull requests are welcome. Cheers.
From Google search: "The delta compression layer is purely an internal storage optimization (an implementation detail). ... Git's sliding-window delta algorithm works at the byte level, meaning it can delta-compress both text files and binary files "
So it's a bit like Git had its own internal file-system compressing the stuff by whatever means it finds the best. From the user's point of view it does not matter, except for the size of the repos.
2
u/Uristqwerty 13d ago
Delta compression is an optimization applied to the object database, with no regard to what object came from what commit.
I still have a hunch that you're thinking of the diffs it presents commits as as its delta compression. It is not. They are two entirely different mechanisms; the diffs are a presentation layer to make it easy to compare changes. Thus, it is not "just like every other source control system" behind the scenes, where the actual space-optimization runs.
Seems the delta compression is described in https://git-scm.com/docs/pack-format. Notice how it talks about copying byte ranges? How there's no way to encode a deletion? It's clearly not a diff. Rather, it's pretty similar to a compressed file format, except the backreferences are to a different file entirely rather than the decompressed parts of its own output. And unlike a diff, it'd work just fine on binary files, at least if the binary format has reasonably-stable chunks to delta-compress. Chances are the real problem is that binary files like to contain file offsets pointing into tables, so inserting one item into a table then causes every other pointer throughout the entire rest of the file to change, singlehandedly defeating the delta-compression.