From: Junio C Hamano Date: Wed, 22 Feb 2006 06:38:43 +0000 (-0800) Subject: Merge branch 'jc/pack-reuse' X-Git-Tag: v1.3.0-rc1~164 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/155d12912fec6c60ead6d6c1febda5fa6e6eb128?hp=-c Merge branch 'jc/pack-reuse' * jc/pack-reuse: pack-objects: avoid delta chains that are too long. git-repack: allow passing a couple of flags to pack-objects. pack-objects: finishing touches. pack-objects: reuse data from existing packs. --- 155d12912fec6c60ead6d6c1febda5fa6e6eb128 diff --combined sha1_file.c index 1d799f793a,0a3a721e97..9cab99ae7c --- a/sha1_file.c +++ b/sha1_file.c @@@ -551,10 -551,8 +551,10 @@@ static void prepare_packed_git_one(cha sprintf(path, "%s/pack", objdir); len = strlen(path); dir = opendir(path); - if (!dir) + if (!dir) { + fprintf(stderr, "unable to open object pack directory: %s: %s\n", path, strerror(errno)); return; + } path[len++] = '/'; while ((de = readdir(dir)) != NULL) { int namelen = strlen(de->d_name); @@@ -828,6 -826,25 +828,25 @@@ static unsigned long unpack_object_head return offset; } + int check_reuse_pack_delta(struct packed_git *p, unsigned long offset, + unsigned char *base, unsigned long *sizep, + enum object_type *kindp) + { + unsigned long ptr; + int status = -1; + + use_packed_git(p); + ptr = offset; + ptr = unpack_object_header(p, ptr, kindp, sizep); + if (*kindp != OBJ_DELTA) + goto done; + memcpy(base, p->pack_base + ptr, 20); + status = 0; + done: + unuse_packed_git(p); + return status; + } + void packed_object_info_detail(struct pack_entry *e, char *type, unsigned long *size,