Merge branch 'jk/pack-bitmap-progress'
The progress output while repacking and transferring objects showed an apparent large silence while writing the objects out of existing packfiles, when the reachability bitmap was in use. * jk/pack-bitmap-progress: pack-objects: show reused packfile objects in "Counting objects" pack-objects: show progress for reused packfiles
This commit is contained in:
@ -708,7 +708,7 @@ static struct object_entry **compute_write_order(void)
|
|||||||
static off_t write_reused_pack(struct sha1file *f)
|
static off_t write_reused_pack(struct sha1file *f)
|
||||||
{
|
{
|
||||||
unsigned char buffer[8192];
|
unsigned char buffer[8192];
|
||||||
off_t to_write;
|
off_t to_write, total;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (!is_pack_valid(reuse_packfile))
|
if (!is_pack_valid(reuse_packfile))
|
||||||
@ -725,7 +725,7 @@ static off_t write_reused_pack(struct sha1file *f)
|
|||||||
if (reuse_packfile_offset < 0)
|
if (reuse_packfile_offset < 0)
|
||||||
reuse_packfile_offset = reuse_packfile->pack_size - 20;
|
reuse_packfile_offset = reuse_packfile->pack_size - 20;
|
||||||
|
|
||||||
to_write = reuse_packfile_offset - sizeof(struct pack_header);
|
total = to_write = reuse_packfile_offset - sizeof(struct pack_header);
|
||||||
|
|
||||||
while (to_write) {
|
while (to_write) {
|
||||||
int read_pack = xread(fd, buffer, sizeof(buffer));
|
int read_pack = xread(fd, buffer, sizeof(buffer));
|
||||||
@ -738,10 +738,23 @@ static off_t write_reused_pack(struct sha1file *f)
|
|||||||
|
|
||||||
sha1write(f, buffer, read_pack);
|
sha1write(f, buffer, read_pack);
|
||||||
to_write -= read_pack;
|
to_write -= read_pack;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We don't know the actual number of objects written,
|
||||||
|
* only how many bytes written, how many bytes total, and
|
||||||
|
* how many objects total. So we can fake it by pretending all
|
||||||
|
* objects we are writing are the same size. This gives us a
|
||||||
|
* smooth progress meter, and at the end it matches the true
|
||||||
|
* answer.
|
||||||
|
*/
|
||||||
|
written = reuse_packfile_objects *
|
||||||
|
(((double)(total - to_write)) / total);
|
||||||
|
display_progress(progress_state, written);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
written += reuse_packfile_objects;
|
written = reuse_packfile_objects;
|
||||||
|
display_progress(progress_state, written);
|
||||||
return reuse_packfile_offset - sizeof(struct pack_header);
|
return reuse_packfile_offset - sizeof(struct pack_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1022,7 +1035,7 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
|
|||||||
exclude, name && no_try_delta(name),
|
exclude, name && no_try_delta(name),
|
||||||
index_pos, found_pack, found_offset);
|
index_pos, found_pack, found_offset);
|
||||||
|
|
||||||
display_progress(progress_state, to_pack.nr_objects);
|
display_progress(progress_state, nr_result);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1038,7 +1051,7 @@ static int add_object_entry_from_bitmap(const unsigned char *sha1,
|
|||||||
|
|
||||||
create_object_entry(sha1, type, name_hash, 0, 0, index_pos, pack, offset);
|
create_object_entry(sha1, type, name_hash, 0, 0, index_pos, pack, offset);
|
||||||
|
|
||||||
display_progress(progress_state, to_pack.nr_objects);
|
display_progress(progress_state, nr_result);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2437,12 +2450,7 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
|
|||||||
&reuse_packfile_offset)) {
|
&reuse_packfile_offset)) {
|
||||||
assert(reuse_packfile_objects);
|
assert(reuse_packfile_objects);
|
||||||
nr_result += reuse_packfile_objects;
|
nr_result += reuse_packfile_objects;
|
||||||
|
display_progress(progress_state, nr_result);
|
||||||
if (progress) {
|
|
||||||
fprintf(stderr, "Reusing existing pack: %d, done.\n",
|
|
||||||
reuse_packfile_objects);
|
|
||||||
fflush(stderr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse_bitmap_commit_list(&add_object_entry_from_bitmap);
|
traverse_bitmap_commit_list(&add_object_entry_from_bitmap);
|
||||||
|
Reference in New Issue
Block a user