summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3408146)
raw | patch | inline | side by side (parent: 3408146)
author | Nicolas Pitre <nico@cam.org> | |
Thu, 28 Feb 2008 05:25:19 +0000 (00:25 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 1 Mar 2008 09:44:46 +0000 (01:44 -0800) |
Since commit eb32d236df0c16b936b04f0c5402addb61cdb311, there was a TODO
comment in packed_object_info_detail() about the SHA1 of base object to
OBJ_OFS_DELTA objects. So here it is at last.
While at it, providing the actual storage size information as well is now
trivial.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
comment in packed_object_info_detail() about the SHA1 of base object to
OBJ_OFS_DELTA objects. So here it is at last.
While at it, providing the actual storage size information as well is now
trivial.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-check.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
diff --git a/pack-check.c b/pack-check.c
index d7dd62bb8346c4cac8dbd7334e999a450c21c5ab..ae2568503665e55db33c765f0b2816b6b198f69d 100644 (file)
--- a/pack-check.c
+++ b/pack-check.c
#include "cache.h"
#include "pack.h"
+#include "pack-revindex.h"
struct idx_entry
{
static void show_pack_info(struct packed_git *p)
{
uint32_t nr_objects, i, chain_histogram[MAX_CHAIN+1];
+
nr_objects = p->num_objects;
memset(chain_histogram, 0, sizeof(chain_histogram));
+ init_pack_revindex();
for (i = 0; i < nr_objects; i++) {
const unsigned char *sha1;
diff --git a/sha1_file.c b/sha1_file.c
index 1ddb96bb82b60f4da8489664d13f398d88bf5a15..445a871db31673af20017d36ff22fd106f77f510 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
#include "tag.h"
#include "tree.h"
#include "refs.h"
+#include "pack-revindex.h"
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
unsigned long dummy;
unsigned char *next_sha1;
enum object_type type;
+ struct revindex_entry *revidx;
*delta_chain_length = 0;
curpos = obj_offset;
type = unpack_object_header(p, &w_curs, &curpos, size);
+ revidx = find_pack_revindex(p, obj_offset);
+ *store_size = revidx[1].offset - obj_offset;
+
for (;;) {
switch (type) {
default:
case OBJ_TREE:
case OBJ_BLOB:
case OBJ_TAG:
- *store_size = 0; /* notyet */
unuse_pack(&w_curs);
return typename(type);
case OBJ_OFS_DELTA:
obj_offset = get_delta_base(p, &w_curs, &curpos, type, obj_offset);
if (*delta_chain_length == 0) {
- /* TODO: find base_sha1 as pointed by curpos */
- hashclr(base_sha1);
+ revidx = find_pack_revindex(p, obj_offset);
+ hashcpy(base_sha1, nth_packed_object_sha1(p, revidx->nr));
}
break;
case OBJ_REF_DELTA: