diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2017-08-18 15:20:31 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-23 15:12:07 -0700 |
commit | d5a16761820f2539bf8610c8f0c64f610e29314e (patch) | |
tree | 4081ca185c262f7a2b6acec8c830a4172789e720 /packfile.h | |
parent | f1d8130be0a7229b215b76eac54c561a0124bc99 (diff) | |
download | git-d5a16761820f2539bf8610c8f0c64f610e29314e.tar.gz |
pack: move nth_packed_object_{sha1,oid}
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'packfile.h')
-rw-r--r-- | packfile.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/packfile.h b/packfile.h index 6a8d46c851..790b174cb3 100644 --- a/packfile.h +++ b/packfile.h @@ -63,6 +63,21 @@ extern void unuse_pack(struct pack_window **); extern void clear_delta_base_cache(void); extern struct packed_git *add_packed_git(const char *path, size_t path_len, int local); +/* + * Return the SHA-1 of the nth object within the specified packfile. + * Open the index if it is not already open. The return value points + * at the SHA-1 within the mmapped index. Return NULL if there is an + * error. + */ +extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t n); +/* + * Like nth_packed_object_sha1, but write the data into the object specified by + * the the first argument. Returns the first argument on success, and NULL on + * error. + */ +extern const struct object_id *nth_packed_object_oid(struct object_id *, struct packed_git *, uint32_t n); + + extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *); extern unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep); extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t); @@ -79,5 +94,4 @@ extern int packed_object_info(struct packed_git *pack, off_t offset, struct obje extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1); extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1); - #endif |