aboutsummaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 1ddb96bb8..445a871db 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -14,6 +14,7 @@
#include "tag.h"
#include "tree.h"
#include "refs.h"
+#include "pack-revindex.h"
#ifndef O_NOATIME
#if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
@@ -1367,11 +1368,15 @@ const char *packed_object_info_detail(struct packed_git *p,
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:
@@ -1381,14 +1386,13 @@ const char *packed_object_info_detail(struct packed_git *p,
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: