221
static int num_preferred_base;
222
static struct progress *progress_state;
223
224
-static struct packed_git *reuse_packfile;
224
+static struct bitmapped_pack *reuse_packfiles;
225
+static size_t reuse_packfiles_nr;
226
static uint32_t reuse_packfile_objects;
227
static struct bitmap *reuse_packfile_bitmap;
228
1095
copy_pack_data(out, reuse_packfile, w_curs, offset, next - offset);
1096
}
1097
1097
-static size_t write_reused_pack_verbatim(struct packed_git *reuse_packfile,
1098
+static size_t write_reused_pack_verbatim(struct bitmapped_pack *reuse_packfile,
1099
struct hashfile *out,
1100
off_t pack_start UNUSED,
1101
struct pack_window **w_curs)
1110
off_t to_write;
1111
1112
written = (pos * BITS_IN_EWORD);
1112
- to_write = pack_pos_to_offset(reuse_packfile, written)
1113
+ to_write = pack_pos_to_offset(reuse_packfile->p, written)
1114
- sizeof(struct pack_header);
1115
1116
/* We're recording one chunk, not one object. */
1117
record_reused_object(sizeof(struct pack_header), 0);
1118
hashflush(out);
1118
- copy_pack_data(out, reuse_packfile, w_curs,
1119
+ copy_pack_data(out, reuse_packfile->p, w_curs,
1120
sizeof(struct pack_header), to_write);
1121
1122
display_progress(progress_state, written);
1124
return pos;
1125
}
1126
1126
-static void write_reused_pack(struct packed_git *reuse_packfile,
1127
+static void write_reused_pack(struct bitmapped_pack *reuse_packfile,
1128
struct hashfile *f)
1129
{
1130
size_t i = 0;
1150
* bitmaps. See comment in try_partial_reuse()
1151
* for why.
1152
*/
1152
- write_reused_pack_one(reuse_packfile, pos + offset, f,
1153
- pack_start, &w_curs);
1153
+ write_reused_pack_one(reuse_packfile->p, pos + offset,
1154
+ f, pack_start, &w_curs);
1155
display_progress(progress_state, ++written);
1156
}
1157
}
1207
1208
offset = write_pack_header(f, nr_remaining);
1209
1209
- if (reuse_packfile) {
1210
+ if (reuse_packfiles_nr) {
1211
assert(pack_to_stdout);
1211
- write_reused_pack(reuse_packfile, f);
1212
+ for (j = 0; j < reuse_packfiles_nr; j++) {
1213
+ reused_chunks_nr = 0;
1214
+ write_reused_pack(&reuse_packfiles[j], f);
1215
+ }
1216
offset = hashfile_total(f);
1217
}
1218
3953
3954
static int get_object_list_from_bitmap(struct rev_info *revs)
3955
{
3952
- struct bitmapped_pack *packs = NULL;
3953
- size_t packs_nr = 0;
3954
-
3956
if (!(bitmap_git = prepare_bitmap_walk(revs, 0)))
3957
return -1;
3958
3959
if (pack_options_allow_reuse())
3959
- reuse_partial_packfile_from_bitmap(bitmap_git, &packs,
3960
- &packs_nr,
3960
+ reuse_partial_packfile_from_bitmap(bitmap_git,
3961
+ &reuse_packfiles,
3962
+ &reuse_packfiles_nr,
3963
&reuse_packfile_bitmap);
3964
3963
- if (packs) {
3964
- reuse_packfile = packs[0].p;
3965
+ if (reuse_packfiles) {
3966
reuse_packfile_objects = bitmap_popcount(reuse_packfile_bitmap);
3967
if (!reuse_packfile_objects)
3968
BUG("expected non-empty reuse bitmap");