summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-10 21:03:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-10 21:03:47 (GMT)
commite6e24c94df9df6d39f2316113c14fe07d2ab03d7 (patch)
tree1f883be2ac3f3a84ce5af3cd1e9e32c45648e21e /sha1_file.c
parentb8688adb12d086b161aa7c369126bdd56843a01b (diff)
parentc9af708b1a5a92cbde2a0c9a75b13530f792ac84 (diff)
downloadgit-e6e24c94df9df6d39f2316113c14fe07d2ab03d7.zip
git-e6e24c94df9df6d39f2316113c14fe07d2ab03d7.tar.gz
git-e6e24c94df9df6d39f2316113c14fe07d2ab03d7.tar.bz2
Merge branch 'jk/pack-objects-optim-mru'
"git pack-objects" in a repository with many packfiles used to spend a lot of time looking for/at objects in them; the accesses to the packfiles are now optimized by checking the most-recently-used packfile first. * jk/pack-objects-optim-mru: pack-objects: use mru list when iterating over packs pack-objects: break delta cycles before delta-search phase sha1_file: make packed_object_info public provide an initializer for "struct object_info"
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 94daf31..309e87d 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1826,11 +1826,9 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,
int parse_sha1_header(const char *hdr, unsigned long *sizep)
{
- struct object_info oi;
+ struct object_info oi = OBJECT_INFO_INIT;
oi.sizep = sizep;
- oi.typename = NULL;
- oi.typep = NULL;
return parse_sha1_header_extended(hdr, &oi, LOOKUP_REPLACE_OBJECT);
}
@@ -2068,8 +2066,8 @@ unwind:
goto out;
}
-static int packed_object_info(struct packed_git *p, off_t obj_offset,
- struct object_info *oi)
+int packed_object_info(struct packed_git *p, off_t obj_offset,
+ struct object_info *oi)
{
struct pack_window *w_curs = NULL;
unsigned long size;
@@ -2840,7 +2838,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
{
enum object_type type;
- struct object_info oi = {NULL};
+ struct object_info oi = OBJECT_INFO_INIT;
oi.typep = &type;
oi.sizep = sizep;