packfile: add repository argument to unpack_entry
Add a repository argument to allow the callers of unpack_entry to be more specific about which repository to act on. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
5da6534dd6
commit
57a6a500be
@ -1376,7 +1376,7 @@ static void *gfi_unpack_entry(
|
|||||||
*/
|
*/
|
||||||
p->pack_size = pack_size + the_hash_algo->rawsz;
|
p->pack_size = pack_size + the_hash_algo->rawsz;
|
||||||
}
|
}
|
||||||
return unpack_entry(p, oe->idx.offset, &type, sizep);
|
return unpack_entry(the_repository, p, oe->idx.offset, &type, sizep);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *get_mode(const char *str, uint16_t *modep)
|
static const char *get_mode(const char *str, uint16_t *modep)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
#include "repository.h"
|
||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
#include "pack-revindex.h"
|
#include "pack-revindex.h"
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
@ -134,7 +135,7 @@ static int verify_packfile(struct packed_git *p,
|
|||||||
data = NULL;
|
data = NULL;
|
||||||
data_valid = 0;
|
data_valid = 0;
|
||||||
} else {
|
} else {
|
||||||
data = unpack_entry(p, entries[i].offset, &type, &size);
|
data = unpack_entry(the_repository, p, entries[i].offset, &type, &size);
|
||||||
data_valid = 1;
|
data_valid = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1279,7 +1279,7 @@ static void *cache_or_unpack_entry(struct packed_git *p, off_t base_offset,
|
|||||||
|
|
||||||
ent = get_delta_base_cache_entry(p, base_offset);
|
ent = get_delta_base_cache_entry(p, base_offset);
|
||||||
if (!ent)
|
if (!ent)
|
||||||
return unpack_entry(p, base_offset, type, base_size);
|
return unpack_entry(the_repository, p, base_offset, type, base_size);
|
||||||
|
|
||||||
if (type)
|
if (type)
|
||||||
*type = ent->type;
|
*type = ent->type;
|
||||||
@ -1485,8 +1485,9 @@ static void *read_object_the_repository(const struct object_id *oid,
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *unpack_entry(struct packed_git *p, off_t obj_offset,
|
void *unpack_entry_the_repository(struct packed_git *p, off_t obj_offset,
|
||||||
enum object_type *final_type, unsigned long *final_size)
|
enum object_type *final_type,
|
||||||
|
unsigned long *final_size)
|
||||||
{
|
{
|
||||||
struct pack_window *w_curs = NULL;
|
struct pack_window *w_curs = NULL;
|
||||||
off_t curpos = obj_offset;
|
off_t curpos = obj_offset;
|
||||||
|
@ -115,7 +115,8 @@ extern off_t nth_packed_object_offset(const struct packed_git *, uint32_t n);
|
|||||||
extern off_t find_pack_entry_one(const unsigned char *sha1, struct packed_git *);
|
extern off_t find_pack_entry_one(const unsigned char *sha1, struct packed_git *);
|
||||||
|
|
||||||
extern int is_pack_valid(struct packed_git *);
|
extern int is_pack_valid(struct packed_git *);
|
||||||
extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *);
|
#define unpack_entry(r, p, of, ot, s) unpack_entry_##r(p, of, ot, s)
|
||||||
|
extern void *unpack_entry_the_repository(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 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);
|
extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
|
||||||
extern int unpack_object_header(struct packed_git *, struct pack_window **, off_t *, unsigned long *);
|
extern int unpack_object_header(struct packed_git *, struct pack_window **, off_t *, unsigned long *);
|
||||||
|
Loading…
Reference in New Issue
Block a user