pack-objects: show reused packfile objects in "Counting objects"
When we are sending a pack for push or fetch, we may reuse a chunk of packfile without even parsing it. The progress meter then looks like this: Reusing existing pack: 3440489, done. Counting objects: 3, done. The first line shows that we are reusing a large chunk of objects, and then we further count any objects not included in the reused portion with an actual traversal. These are all implementation details that the user does not need to care about. Instead, we can show the reused objects in the normal "counting..." progress meter (which will simply go much faster than normal), and then continue to add to it as we traverse. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Mar 14, 2014 at 22:26 UTC
78d2214eb4d10ea1e30dd7e69a4e6d73d9f66164
1 file changed
+3
-8
builtin/pack-objects.c
+3
-8
@@ -1028,7 +1028,7 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
1028
exclude, name && no_try_delta(name),
1029
index_pos, found_pack, found_offset);
1030
1031
- display_progress(progress_state, to_pack.nr_objects);
1031
+ display_progress(progress_state, nr_result);
1032
return 1;
1033
}
1034
@@ -1044,7 +1044,7 @@ static int add_object_entry_from_bitmap(const unsigned char *sha1,
1044
1045
create_object_entry(sha1, type, name_hash, 0, 0, index_pos, pack, offset);
1046
1047
- display_progress(progress_state, to_pack.nr_objects);
1047
+ display_progress(progress_state, nr_result);
1048
return 1;
1049
}
1050
@@ -2446,12 +2446,7 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
2446
&reuse_packfile_offset)) {
2447
assert(reuse_packfile_objects);
2448
nr_result += reuse_packfile_objects;
2449
-
2450
- if (progress) {
2451
- fprintf(stderr, "Reusing existing pack: %d, done.\n",
2452
- reuse_packfile_objects);
2453
- fflush(stderr);
2454
- }
2449
+ display_progress(progress_state, nr_result);
2450
}
2451
2452
traverse_bitmap_commit_list(&add_object_entry_from_bitmap);