X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=sha1_file.c;fp=sha1_file.c;h=f4b10894c8be74d3ab3be8ec6d81f35634399010;hb=3f9ac8d259fb919e001671c5e403e5fceaabf0d8;hp=c08da35d8a2c9f9fb02370769e87578ec1f2fcce;hpb=26125f6b9be8dac31f56bf3da60dfa0df6dc0b59;p=git.git diff --git a/sha1_file.c b/sha1_file.c index c08da35d..f4b10894 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -841,6 +841,25 @@ static unsigned long unpack_object_header(struct packed_git *p, unsigned long of 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,