mirror of
https://github.com/git/git.git
synced 2024-11-18 02:23:52 +01:00
pack-*.c: remove the_repository references
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
94e10825bd
commit
7c14112741
@ -3481,7 +3481,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
}
|
||||
|
||||
prepare_packing_data(&to_pack);
|
||||
prepare_packing_data(the_repository, &to_pack);
|
||||
|
||||
if (progress)
|
||||
progress_state = start_progress(_("Enumerating objects"), 0);
|
||||
|
@ -77,7 +77,7 @@ void bitmap_writer_build_type_index(struct packing_data *to_pack,
|
||||
break;
|
||||
|
||||
default:
|
||||
real_type = oid_object_info(the_repository,
|
||||
real_type = oid_object_info(to_pack->repo,
|
||||
&entry->idx.oid, NULL);
|
||||
break;
|
||||
}
|
||||
@ -262,7 +262,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
|
||||
if (writer.show_progress)
|
||||
writer.progress = start_progress("Building bitmaps", writer.selected_nr);
|
||||
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
repo_init_revisions(to_pack->repo, &revs, NULL);
|
||||
revs.tag_objects = 1;
|
||||
revs.tree_objects = 1;
|
||||
revs.blob_objects = 1;
|
||||
@ -363,7 +363,7 @@ static int date_compare(const void *_a, const void *_b)
|
||||
void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack)
|
||||
{
|
||||
struct bitmap_index *bitmap_git;
|
||||
if (!(bitmap_git = prepare_bitmap_git()))
|
||||
if (!(bitmap_git = prepare_bitmap_git(to_pack->repo)))
|
||||
return;
|
||||
|
||||
writer.reused = kh_init_sha1();
|
||||
|
@ -328,14 +328,15 @@ failed:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int open_pack_bitmap(struct bitmap_index *bitmap_git)
|
||||
static int open_pack_bitmap(struct repository *r,
|
||||
struct bitmap_index *bitmap_git)
|
||||
{
|
||||
struct packed_git *p;
|
||||
int ret = -1;
|
||||
|
||||
assert(!bitmap_git->map);
|
||||
|
||||
for (p = get_all_packs(the_repository); p; p = p->next) {
|
||||
for (p = get_all_packs(r); p; p = p->next) {
|
||||
if (open_pack_bitmap_1(bitmap_git, p) == 0)
|
||||
ret = 0;
|
||||
}
|
||||
@ -343,11 +344,11 @@ static int open_pack_bitmap(struct bitmap_index *bitmap_git)
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct bitmap_index *prepare_bitmap_git(void)
|
||||
struct bitmap_index *prepare_bitmap_git(struct repository *r)
|
||||
{
|
||||
struct bitmap_index *bitmap_git = xcalloc(1, sizeof(*bitmap_git));
|
||||
|
||||
if (!open_pack_bitmap(bitmap_git) && !load_pack_bitmap(bitmap_git))
|
||||
if (!open_pack_bitmap(r, bitmap_git) && !load_pack_bitmap(bitmap_git))
|
||||
return bitmap_git;
|
||||
|
||||
free_bitmap_index(bitmap_git);
|
||||
@ -690,7 +691,7 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs)
|
||||
struct bitmap_index *bitmap_git = xcalloc(1, sizeof(*bitmap_git));
|
||||
/* try to open a bitmapped pack, but don't parse it yet
|
||||
* because we may not need to use it */
|
||||
if (open_pack_bitmap(bitmap_git) < 0)
|
||||
if (open_pack_bitmap(revs->repo, bitmap_git) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0; i < revs->pending.nr; ++i) {
|
||||
@ -955,7 +956,7 @@ void test_bitmap_walk(struct rev_info *revs)
|
||||
struct bitmap_test_data tdata;
|
||||
struct bitmap_index *bitmap_git;
|
||||
|
||||
if (!(bitmap_git = prepare_bitmap_git()))
|
||||
if (!(bitmap_git = prepare_bitmap_git(revs->repo)))
|
||||
die("failed to load bitmap indexes");
|
||||
|
||||
if (revs->pending.nr != 1)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "pack-objects.h"
|
||||
|
||||
struct commit;
|
||||
struct repository;
|
||||
struct rev_info;
|
||||
|
||||
struct bitmap_disk_header {
|
||||
@ -39,7 +40,7 @@ typedef int (*show_reachable_fn)(
|
||||
|
||||
struct bitmap_index;
|
||||
|
||||
struct bitmap_index *prepare_bitmap_git(void);
|
||||
struct bitmap_index *prepare_bitmap_git(struct repository *r);
|
||||
void count_bitmap_commit_list(struct bitmap_index *, uint32_t *commits,
|
||||
uint32_t *trees, uint32_t *blobs, uint32_t *tags);
|
||||
void traverse_bitmap_commit_list(struct bitmap_index *,
|
||||
|
@ -99,7 +99,7 @@ static void prepare_in_pack_by_idx(struct packing_data *pdata)
|
||||
* (i.e. in_pack_idx also zero) should return NULL.
|
||||
*/
|
||||
mapping[cnt++] = NULL;
|
||||
for (p = get_all_packs(the_repository); p; p = p->next, cnt++) {
|
||||
for (p = get_all_packs(pdata->repo); p; p = p->next, cnt++) {
|
||||
if (cnt == nr) {
|
||||
free(mapping);
|
||||
return;
|
||||
@ -133,8 +133,10 @@ void oe_map_new_pack(struct packing_data *pack,
|
||||
}
|
||||
|
||||
/* assume pdata is already zero'd by caller */
|
||||
void prepare_packing_data(struct packing_data *pdata)
|
||||
void prepare_packing_data(struct repository *r, struct packing_data *pdata)
|
||||
{
|
||||
pdata->repo = r;
|
||||
|
||||
if (git_env_bool("GIT_TEST_FULL_IN_PACK_ARRAY", 0)) {
|
||||
/*
|
||||
* do not initialize in_pack_by_idx[] to force the
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "thread-utils.h"
|
||||
#include "pack.h"
|
||||
|
||||
struct repository;
|
||||
|
||||
#define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)
|
||||
|
||||
#define OE_DFS_STATE_BITS 2
|
||||
@ -127,6 +129,7 @@ struct object_entry {
|
||||
};
|
||||
|
||||
struct packing_data {
|
||||
struct repository *repo;
|
||||
struct object_entry *objects;
|
||||
uint32_t nr_objects, nr_alloc;
|
||||
|
||||
@ -165,7 +168,7 @@ struct packing_data {
|
||||
unsigned char *layer;
|
||||
};
|
||||
|
||||
void prepare_packing_data(struct packing_data *pdata);
|
||||
void prepare_packing_data(struct repository *r, struct packing_data *pdata);
|
||||
|
||||
static inline void packing_data_lock(struct packing_data *pdata)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user