summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-05-20 16:59:17 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-20 15:41:45 -0700
commitd1af002dc608be3213ba18df1a99ced0ab42e6d6 (patch)
tree191c45603eb3bc4aca09df7721bef8c740786ed5 /object.c
parent91d7b8afc2dc8bacde2012ad076cd8d0c4d36697 (diff)
downloadgit-d1af002dc608be3213ba18df1a99ced0ab42e6d6.tar.gz
[PATCH] delta check
This adds knowledge of delta objects to fsck-cache and various object parsing code. A new switch to git-fsck-cache is provided to display the maximum delta depth found in a repository. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'object.c')
-rw-r--r--object.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/object.c b/object.c
index b5a62e7f87..deb683076d 100644
--- a/object.c
+++ b/object.c
@@ -4,6 +4,7 @@
#include "commit.h"
#include "cache.h"
#include "tag.h"
+#include "delta.h"
#include <stdlib.h>
#include <string.h>
@@ -104,6 +105,7 @@ struct object *parse_object(unsigned char *sha1)
unsigned long mapsize;
void *map = map_sha1_file(sha1, &mapsize);
if (map) {
+ int is_delta;
struct object *obj;
char type[100];
unsigned long size;
@@ -111,9 +113,14 @@ struct object *parse_object(unsigned char *sha1)
munmap(map, mapsize);
if (!buffer)
return NULL;
- if (check_sha1_signature(sha1, buffer, size, type) < 0)
+ is_delta = !strcmp(type, "delta");
+ if (!is_delta && check_sha1_signature(sha1, buffer, size, type) < 0)
printf("sha1 mismatch %s\n", sha1_to_hex(sha1));
- if (!strcmp(type, "blob")) {
+ if (is_delta) {
+ struct delta *delta = lookup_delta(sha1);
+ parse_delta_buffer(delta, buffer, size);
+ obj = (struct object *) delta;
+ } else if (!strcmp(type, "blob")) {
struct blob *blob = lookup_blob(sha1);
parse_blob_buffer(blob, buffer, size);
obj = &blob->object;