Skip to content

Commit

Permalink
[PATCH] Remove "delta" object representation.
Browse files Browse the repository at this point in the history
Packed delta files created by git-pack-objects seems to be the
way to go, and existing "delta" object handling code has exposed
the object representation details to too many places.  Remove it
while we refactor code to come up with a proper interface in
sha1_file.c.

Signed-off-by: Junio C Hamano <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Junio C Hamano authored and Linus Torvalds committed Jun 27, 2005
1 parent ee85cbc commit c4584ae
Show file tree
Hide file tree
Showing 25 changed files with 22 additions and 948 deletions.
5 changes: 1 addition & 4 deletions Documentation/git-fsck-cache.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-fsck-cache - Verifies the connectivity and validity of the objects in the da

SYNOPSIS
--------
'git-fsck-cache' [--tags] [--root] [--delta-depth] [--unreachable] [--cache] [<object>*]
'git-fsck-cache' [--tags] [--root] [--unreachable] [--cache] [<object>*]

DESCRIPTION
-----------
Expand Down Expand Up @@ -37,9 +37,6 @@ OPTIONS
Consider any object recorded in the cache also as a head node for
an unreachability trace.

--delta-depth::
Report back the length of the longest delta chain found.

It tests SHA1 and general object sanity, and it does full tracking of
the resulting reachability and everything else. It prints out any
corruption it finds (missing or bad objects), and if you use the
Expand Down
7 changes: 0 additions & 7 deletions Documentation/git-http-pull.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ Downloads a remote GIT repository via HTTP.
Get trees associated with the commit objects.
-a::
Get all the objects.
-d::
Do not check for delta base objects (use this option
only when you know the remote repository is not
deltified).
--recover::
Check dependency of deltified object more carefully than
usual, to recover after earlier pull that was interrupted.
-v::
Report what is downloaded.
-w::
Expand Down
7 changes: 0 additions & 7 deletions Documentation/git-local-pull.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ OPTIONS
Get trees associated with the commit objects.
-a::
Get all the objects.
-d::
Do not check for delta base objects (use this option
only when you know the remote repository is not
deltified).
--recover::
Check dependency of deltified object more carefully than
usual, to recover after earlier pull that was interrupted.
-v::
Report what is downloaded.
-w::
Expand Down
45 changes: 0 additions & 45 deletions Documentation/git-mkdelta.txt

This file was deleted.

7 changes: 0 additions & 7 deletions Documentation/git-ssh-pull.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ commit-id::
Get trees associated with the commit objects.
-a::
Get all the objects.
-d::
Do not check for delta base objects (use this option
only when you know the remote repository is not
deltified).
--recover::
Check dependency of deltified object more carefully than
usual, to recover after earlier pull that was interrupted.
-v::
Report what is downloaded.
-w::
Expand Down
7 changes: 0 additions & 7 deletions Documentation/git-ssh-push.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ commit-id::
Get tree associated with the requested commit object.
-a::
Get all the objects.
-d::
Do not check for delta base objects (use this option
only when you know the local repository is not
deltified).
--recover::
Check dependency of deltified object more carefully than
usual, to recover after earlier push that was interrupted.
-v::
Report what is uploaded.
-w::
Expand Down
3 changes: 0 additions & 3 deletions Documentation/git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ link:git-init-db.html[git-init-db]::
link:git-merge-base.html[git-merge-base]::
Finds as good a common ancestor as possible for a merge

link:git-mkdelta.html[git-mkdelta]::
Creates a delta object

link:git-mktag.html[git-mktag]::
Creates a tag object

Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INSTALL=install

SCRIPTS=git git-apply-patch-script git-merge-one-file-script git-prune-script \
git-pull-script git-tag-script git-resolve-script git-whatchanged \
git-deltafy-script git-fetch-script git-status-script git-commit-script \
git-fetch-script git-status-script git-commit-script \
git-log-script git-shortlog git-cvsimport-script git-diff-script \
git-reset-script git-add-script git-checkout-script git-clone-script \
gitk git-cherry git-rebase-script git-relink-script
Expand All @@ -34,7 +34,7 @@ PROG= git-update-cache git-diff-files git-init-db git-write-tree \
git-unpack-file git-export git-diff-cache git-convert-cache \
git-http-pull git-ssh-push git-ssh-pull git-rev-list git-mktag \
git-diff-helper git-tar-tree git-local-pull git-write-blob \
git-get-tar-commit-id git-mkdelta git-apply git-stripspace \
git-get-tar-commit-id git-apply git-stripspace \
git-cvs2git git-diff-stages git-rev-parse git-patch-id \
git-pack-objects git-unpack-objects

Expand All @@ -44,7 +44,7 @@ install: $(PROG) $(SCRIPTS)
$(INSTALL) $(PROG) $(SCRIPTS) $(dest)$(bin)

LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
tag.o delta.o date.o index.o diff-delta.o patch-delta.o entry.o \
tag.o date.o index.o diff-delta.o patch-delta.o entry.o \
epoch.o refs.o csum-file.o
LIB_FILE=libgit.a
LIB_H=cache.h object.h blob.h tree.h commit.h tag.h delta.h epoch.h csum-file.h
Expand Down Expand Up @@ -117,7 +117,6 @@ git-mktag: mktag.c
git-diff-helper: diff-helper.c
git-tar-tree: tar-tree.c
git-write-blob: write-blob.c
git-mkdelta: mkdelta.c
git-stripspace: stripspace.c
git-cvs2git: cvs2git.c
git-diff-stages: diff-stages.c
Expand Down
35 changes: 4 additions & 31 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ build up a hierarchy of objects.
All objects have a statically determined "type" aka "tag", which is
determined at object creation time, and which identifies the format of
the object (i.e. how it is used, and how it can refer to other
objects). There are currently five different object types: "blob",
"tree", "commit", "tag" and "delta"
objects). There are currently four different object types: "blob",
"tree", "commit" and "tag".

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

A "delta" object is used internally by the object database to minimise
disk usage. Instead of storing the entire contents of a revision, git
can behave in a similar manner to RCS et al and simply store a delta.

Regardless of object type, all objects share the following
characteristics: they are all deflated with zlib, and have a header
that not only specifies their tag, but also provides size information
about the data in the object. It's worth noting that the SHA1 hash
that is used to name the object is the hash of the original data or
the delta. (Historical note: in the dawn of the age of git the hash
that is used to name the object is the hash of the original data.
(Historical note: in the dawn of the age of git the hash
was the sha1 of the _compressed_ object)

As a result, the general consistency of an object can always be tested
Expand Down Expand Up @@ -219,29 +215,6 @@ verification) has to come from outside.
A tag is created with link:git-mktag.html[git-mktag] and
it's data can be accessed by link:git-cat-file.html[git-cat-file]

Delta Object
~~~~~~~~~~~~

The "delta" object is used internally by the object database to
minimise storage usage by using xdeltas (byte level diffs). Deltas can
form chains of arbitrary length as RCS does (although this is
configureable at creation time). Most operations won't see or even be
aware of delta objects as they are automatically 'applied' and appear
as 'real' git objects In other words, if you write your own routines
to look at the contents of the object database then you need to know
about this - otherwise you don't. Actually, that's not quite true -
one important area where deltas are likely to prove very valuable is
in reducing bandwidth loads - so the more sophisticated network tools
for git repositories will be aware of them too.

Finally, git repositories can (and must) be deltafied in the
background - the work to calculate the differences does not take place
automatically at commit time.

A delta can be created (or undeltafied) with
link:git-mkdelta.html[git-mkdelta] it's raw data cannot be accessed at
present.


The "index" aka "Current Directory Cache"
-----------------------------------------
Expand Down
1 change: 0 additions & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ extern char *sha1_file_name(const unsigned char *sha1);
extern void * map_sha1_file(const unsigned char *sha1, unsigned long *size);
extern int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void *buffer, unsigned long size);
extern int parse_sha1_header(char *hdr, char *type, unsigned long *sizep);
extern int sha1_delta_base(const unsigned char *, unsigned char *);
extern int sha1_file_size(const unsigned char *, unsigned long *);
extern void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned long *size);
extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size);
Expand Down
114 changes: 0 additions & 114 deletions delta.c

This file was deleted.

9 changes: 0 additions & 9 deletions delta.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,4 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
void *delta_buf, unsigned long delta_size,
unsigned long *dst_size);

/* handling of delta objects */
struct delta;
struct object_list;
extern struct delta *lookup_delta(const unsigned char *sha1);
extern int parse_delta_buffer(struct delta *item, void *buffer, unsigned long size);
extern int parse_delta(struct delta *item, unsigned char sha1);
extern int process_deltas(void *src, unsigned long src_size,
const char *src_type, struct object_list *delta);

#endif
Loading

0 comments on commit c4584ae

Please sign in to comment.