Skip to content

Commit 2aef5bb

Browse files
lbtLinus Torvalds
authored andcommitted
[PATCH] Docs - delta object
Added delta documentation Signed-off-by: David Greaves <david@dgreaves.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 7096a64 commit 2aef5bb

File tree

4 files changed

+89
-10
lines changed

4 files changed

+89
-10
lines changed

Documentation/git-fsck-cache.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ git-fsck-cache - Verifies the connectivity and validity of the objects in the da
99

1010
SYNOPSIS
1111
--------
12-
'git-fsck-cache' [--tags] [--root] [[--unreachable] [--cache] <object>\*]
12+
'git-fsck-cache' [--tags] [--root] [--delta-depth] [[--unreachable] [--cache] <object>\*]
1313

1414
DESCRIPTION
1515
-----------
@@ -34,6 +34,9 @@ OPTIONS
3434
Consider any object recorded in the cache also as a head node for
3535
an unreachability trace.
3636

37+
--delta-depth::
38+
Report back the length of the longest delta chain found.
39+
3740
It tests SHA1 and general object sanity, and it does full tracking of
3841
the resulting reachability and everything else. It prints out any
3942
corruption it finds (missing or bad objects), and if you use the

Documentation/git-mkdelta.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
git-mkdelta(1)
2+
==============
3+
May 2005
4+
5+
NAME
6+
----
7+
git-mkdelta - Creates a delta object
8+
9+
10+
SYNOPSIS
11+
--------
12+
'git-mkdelta' [-v] [-d N | --max-depth=N ] <reference_object> <target_object> [ <next_object> ... ]
13+
14+
DESCRIPTION
15+
-----------
16+
Creates a delta object to replace <reference_object> by using an
17+
ordered list of potential objects to deltafy against earlier objects
18+
in the list.
19+
20+
A cap on the depth of delta references can be provided as well,
21+
otherwise the default is to not have any limit. A limit of 0 will
22+
also undeltafy a given object.
23+
24+
25+
OPTIONS
26+
-------
27+
-v::
28+
Verbose
29+
30+
-d|--max-depth::
31+
limit the number of delta references in a chain
32+
If 0 then all objects are undeltafied.
33+
34+
Author
35+
------
36+
Git is written by Linus Torvalds <torvalds@osdl.org> and the git-list <git@vger.kernel.org>.
37+
38+
Documentation
39+
--------------
40+
Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
41+
42+
GIT
43+
---
44+
Part of the link:git.html[git] suite
45+

Documentation/git.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ link:git-init-db.html[git-init-db]::
5151
link:git-merge-base.html[git-merge-base]::
5252
Finds as good a common ancestor as possible for a merge
5353

54+
link:git-mkdelta.html[git-mkdelta]::
55+
Creates a delta object
56+
5457
link:git-mktag.html[git-mktag]::
5558
Creates a tag object
5659

README

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ build up a hierarchy of objects.
3232
All objects have a statically determined "type" aka "tag", which is
3333
determined at object creation time, and which identifies the format of
3434
the object (i.e. how it is used, and how it can refer to other
35-
objects). There are currently four different object types: "blob",
36-
"tree", "commit" and "tag".
35+
objects). There are currently five different object types: "blob",
36+
"tree", "commit", "tag" and "delta"
3737

3838
A "blob" object cannot refer to any other object, and is, like the tag
3939
implies, a pure storage object containing some user data. It is used to
@@ -62,13 +62,17 @@ A "tag" object symbolically identifies and can be used to sign other
6262
objects. It contains the identifier and type of another object, a
6363
symbolic name (of course!) and, optionally, a signature.
6464

65-
Regardless of object type, all objects are share the following
66-
characteristics: they are all in deflated with zlib, and have a header
67-
that not only specifies their tag, but also size information about the
68-
data in the object. It's worth noting that the SHA1 hash that is used
69-
to name the object is the hash of the original data (historical note:
70-
in the dawn of the age of git this was the sha1 of the _compressed_
71-
object)
65+
A "delta" object is used internally by the object database to minimise
66+
disk usage. Instead of storing the entire contents of a revision, git
67+
can behave in a similar manner to RCS et al and simply store a delta.
68+
69+
Regardless of object type, all objects share the following
70+
characteristics: they are all deflated with zlib, and have a header
71+
that not only specifies their tag, but also provides size information
72+
about the data in the object. It's worth noting that the SHA1 hash
73+
that is used to name the object is the hash of the original data or
74+
the delta. (Historical note: in the dawn of the age of git the hash
75+
was the sha1 of the _compressed_ object)
7276

7377
As a result, the general consistency of an object can always be tested
7478
independently of the contents or the type of the object: all objects can
@@ -215,6 +219,30 @@ verification) has to come from outside.
215219
A tag is created with link:git-mktag.html[git-mktag] and
216220
it's data can be accessed by link:git-cat-file.html[git-cat-file]
217221

222+
Delta Object
223+
~~~~~~~~~~~~
224+
225+
The "delta" object is used internally by the object database to
226+
minimise storage usage by using xdeltas (byte level diffs). Deltas can
227+
form chains of arbitrary length as RCS does (although this is
228+
configureable at creation time). Most operations won't see or even be
229+
aware of delta objects as they are automatically 'applied' and appear
230+
as 'real' git objects In other words, if you write your own routines
231+
to look at the contents of the object database then you need to know
232+
about this - otherwise you don't. Actually, that's not quite true -
233+
one important area where deltas are likely to prove very valuable is
234+
in reducing bandwidth loads - so the more sophisticated network tools
235+
for git repositories will be aware of them too.
236+
237+
Finally, git repositories can (and must) be deltafied in the
238+
background - the work to calculate the differences does not take place
239+
automatically at commit time.
240+
241+
A delta can be created (or undeltafied) with
242+
link:git-mkdelta.html[git-mkdelta] it's raw data cannot be accessed at
243+
present.
244+
245+
218246
The "index" aka "Current Directory Cache"
219247
-----------------------------------------
220248
The index is a simple binary file, which contains an efficient

0 commit comments

Comments
 (0)