Git fork

progress: stop using `the_repository`

Stop using `the_repository` in the "progress" subsystem by passing in a
repository when initializing `struct progress`. Furthermore, store a
pointer to the repository in that struct so that we can pass it to the
trace2 API when logging information.

Adjust callers accordingly by using `the_repository`. While there may be
some callers that have a repository available in their context, this
trivial conversion allows for easier verification and bubbles up the use
of `the_repository` by one level.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Patrick Steinhardt and committed by
Junio C Hamano
1f7e6478 913a1e15

+136 -59
+3 -1
builtin/blame.c
··· 1193 sb.found_guilty_entry = &found_guilty_entry; 1194 sb.found_guilty_entry_data = &pi; 1195 if (show_progress) 1196 - pi.progress = start_delayed_progress(_("Blaming lines"), num_lines); 1197 1198 assign_blame(&sb, opt); 1199
··· 1193 sb.found_guilty_entry = &found_guilty_entry; 1194 sb.found_guilty_entry_data = &pi; 1195 if (show_progress) 1196 + pi.progress = start_delayed_progress(the_repository, 1197 + _("Blaming lines"), 1198 + num_lines); 1199 1200 assign_blame(&sb, opt); 1201
+1
builtin/commit-graph.c
··· 305 oidset_init(&commits, 0); 306 if (opts.progress) 307 progress = start_delayed_progress( 308 _("Collecting commits from input"), 0); 309 310 while (strbuf_getline(&buf, stdin) != EOF) {
··· 305 oidset_init(&commits, 0); 306 if (opts.progress) 307 progress = start_delayed_progress( 308 + the_repository, 309 _("Collecting commits from input"), 0); 310 311 while (strbuf_getline(&buf, stdin) != EOF) {
+8 -4
builtin/fsck.c
··· 197 unsigned int nr = 0; 198 int result = 0; 199 if (show_progress) 200 - progress = start_delayed_progress(_("Checking connectivity"), 0); 201 while (pending.nr) { 202 result |= traverse_one_object(object_array_pop(&pending)); 203 display_progress(progress, ++nr); ··· 703 fprintf_ln(stderr, _("Checking object directory")); 704 705 if (show_progress) 706 - progress = start_progress(_("Checking object directories"), 256); 707 708 for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir, 709 &cb_data); ··· 879 if (show_progress) { 880 for (struct packed_git *p = get_all_packs(r); p; p = p->next) 881 pack_count++; 882 - progress = start_delayed_progress("Verifying reverse pack-indexes", pack_count); 883 pack_count = 0; 884 } 885 ··· 989 total += p->num_objects; 990 } 991 992 - progress = start_progress(_("Checking objects"), total); 993 } 994 for (p = get_all_packs(the_repository); p; 995 p = p->next) {
··· 197 unsigned int nr = 0; 198 int result = 0; 199 if (show_progress) 200 + progress = start_delayed_progress(the_repository, 201 + _("Checking connectivity"), 0); 202 while (pending.nr) { 203 result |= traverse_one_object(object_array_pop(&pending)); 204 display_progress(progress, ++nr); ··· 704 fprintf_ln(stderr, _("Checking object directory")); 705 706 if (show_progress) 707 + progress = start_progress(the_repository, 708 + _("Checking object directories"), 256); 709 710 for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir, 711 &cb_data); ··· 881 if (show_progress) { 882 for (struct packed_git *p = get_all_packs(r); p; p = p->next) 883 pack_count++; 884 + progress = start_delayed_progress(the_repository, 885 + "Verifying reverse pack-indexes", pack_count); 886 pack_count = 0; 887 } 888 ··· 992 total += p->num_objects; 993 } 994 995 + progress = start_progress(the_repository, 996 + _("Checking objects"), total); 997 } 998 for (p = get_all_packs(the_repository); p; 999 p = p->next) {
+5 -2
builtin/index-pack.c
··· 282 max = get_max_object_index(); 283 284 if (verbose) 285 - progress = start_delayed_progress(_("Checking objects"), max); 286 287 for (i = 0; i < max; i++) { 288 foreign_nr += check_object(get_indexed_object(i)); ··· 1249 1250 if (verbose) 1251 progress = start_progress( 1252 progress_title ? progress_title : 1253 from_stdin ? _("Receiving objects") : _("Indexing objects"), 1254 nr_objects); ··· 1329 QSORT(ref_deltas, nr_ref_deltas, compare_ref_delta_entry); 1330 1331 if (verbose || show_resolving_progress) 1332 - progress = start_progress(_("Resolving deltas"), 1333 nr_ref_deltas + nr_ofs_deltas); 1334 1335 nr_dispatched = 0;
··· 282 max = get_max_object_index(); 283 284 if (verbose) 285 + progress = start_delayed_progress(the_repository, 286 + _("Checking objects"), max); 287 288 for (i = 0; i < max; i++) { 289 foreign_nr += check_object(get_indexed_object(i)); ··· 1250 1251 if (verbose) 1252 progress = start_progress( 1253 + the_repository, 1254 progress_title ? progress_title : 1255 from_stdin ? _("Receiving objects") : _("Indexing objects"), 1256 nr_objects); ··· 1331 QSORT(ref_deltas, nr_ref_deltas, compare_ref_delta_entry); 1332 1333 if (verbose || show_resolving_progress) 1334 + progress = start_progress(the_repository, 1335 + _("Resolving deltas"), 1336 nr_ref_deltas + nr_ofs_deltas); 1337 1338 nr_dispatched = 0;
+2 -1
builtin/log.c
··· 2495 rev.add_signoff = cfg.do_signoff; 2496 2497 if (show_progress) 2498 - progress = start_delayed_progress(_("Generating patches"), total); 2499 while (0 <= --nr) { 2500 int shown; 2501 display_progress(progress, total - nr);
··· 2495 rev.add_signoff = cfg.do_signoff; 2496 2497 if (show_progress) 2498 + progress = start_delayed_progress(the_repository, 2499 + _("Generating patches"), total); 2500 while (0 <= --nr) { 2501 int shown; 2502 display_progress(progress, total - nr);
+14 -7
builtin/pack-objects.c
··· 1264 struct object_entry **write_order; 1265 1266 if (progress > pack_to_stdout) 1267 - progress_state = start_progress(_("Writing objects"), nr_result); 1268 ALLOC_ARRAY(written_list, to_pack.nr_objects); 1269 write_order = compute_write_order(); 1270 ··· 2400 struct object_entry **sorted_by_offset; 2401 2402 if (progress) 2403 - progress_state = start_progress(_("Counting objects"), 2404 to_pack.nr_objects); 2405 2406 CALLOC_ARRAY(sorted_by_offset, to_pack.nr_objects); ··· 3220 unsigned nr_done = 0; 3221 3222 if (progress) 3223 - progress_state = start_progress(_("Compressing objects"), 3224 nr_deltas); 3225 QSORT(delta_list, n, type_size_sort); 3226 ll_find_deltas(delta_list, n, window+1, depth, &nr_done); ··· 3648 static void enumerate_cruft_objects(void) 3649 { 3650 if (progress) 3651 - progress_state = start_progress(_("Enumerating cruft objects"), 0); 3652 3653 add_objects_in_unpacked_packs(); 3654 add_unreachable_loose_objects(); ··· 3674 revs.ignore_missing_links = 1; 3675 3676 if (progress) 3677 - progress_state = start_progress(_("Enumerating cruft objects"), 0); 3678 ret = add_unseen_recent_objects_to_traversal(&revs, cruft_expiration, 3679 set_cruft_mtime, 1); 3680 stop_progress(&progress_state); ··· 3693 if (prepare_revision_walk(&revs)) 3694 die(_("revision walk setup failed")); 3695 if (progress) 3696 - progress_state = start_progress(_("Traversing cruft objects"), 0); 3697 nr_seen = 0; 3698 traverse_commit_list(&revs, show_cruft_commit, show_cruft_object, NULL); 3699 ··· 4625 prepare_packing_data(the_repository, &to_pack); 4626 4627 if (progress && !cruft) 4628 - progress_state = start_progress(_("Enumerating objects"), 0); 4629 if (stdin_packs) { 4630 /* avoids adding objects in excluded packs */ 4631 ignore_packed_keep_in_core = 1;
··· 1264 struct object_entry **write_order; 1265 1266 if (progress > pack_to_stdout) 1267 + progress_state = start_progress(the_repository, 1268 + _("Writing objects"), nr_result); 1269 ALLOC_ARRAY(written_list, to_pack.nr_objects); 1270 write_order = compute_write_order(); 1271 ··· 2401 struct object_entry **sorted_by_offset; 2402 2403 if (progress) 2404 + progress_state = start_progress(the_repository, 2405 + _("Counting objects"), 2406 to_pack.nr_objects); 2407 2408 CALLOC_ARRAY(sorted_by_offset, to_pack.nr_objects); ··· 3222 unsigned nr_done = 0; 3223 3224 if (progress) 3225 + progress_state = start_progress(the_repository, 3226 + _("Compressing objects"), 3227 nr_deltas); 3228 QSORT(delta_list, n, type_size_sort); 3229 ll_find_deltas(delta_list, n, window+1, depth, &nr_done); ··· 3651 static void enumerate_cruft_objects(void) 3652 { 3653 if (progress) 3654 + progress_state = start_progress(the_repository, 3655 + _("Enumerating cruft objects"), 0); 3656 3657 add_objects_in_unpacked_packs(); 3658 add_unreachable_loose_objects(); ··· 3678 revs.ignore_missing_links = 1; 3679 3680 if (progress) 3681 + progress_state = start_progress(the_repository, 3682 + _("Enumerating cruft objects"), 0); 3683 ret = add_unseen_recent_objects_to_traversal(&revs, cruft_expiration, 3684 set_cruft_mtime, 1); 3685 stop_progress(&progress_state); ··· 3698 if (prepare_revision_walk(&revs)) 3699 die(_("revision walk setup failed")); 3700 if (progress) 3701 + progress_state = start_progress(the_repository, 3702 + _("Traversing cruft objects"), 0); 3703 nr_seen = 0; 3704 traverse_commit_list(&revs, show_cruft_commit, show_cruft_object, NULL); 3705 ··· 4631 prepare_packing_data(the_repository, &to_pack); 4632 4633 if (progress && !cruft) 4634 + progress_state = start_progress(the_repository, 4635 + _("Enumerating objects"), 0); 4636 if (stdin_packs) { 4637 /* avoids adding objects in excluded packs */ 4638 ignore_packed_keep_in_core = 1;
+2 -1
builtin/prune.c
··· 64 return; 65 66 if (show_progress) 67 - progress = start_delayed_progress(_("Checking connectivity"), 0); 68 mark_reachable_objects(revs, 1, expire, progress); 69 stop_progress(&progress); 70 initialized = 1;
··· 64 return; 65 66 if (show_progress) 67 + progress = start_delayed_progress(the_repository, 68 + _("Checking connectivity"), 0); 69 mark_reachable_objects(revs, 1, expire, progress); 70 stop_progress(&progress); 71 initialized = 1;
+2 -1
builtin/remote.c
··· 820 * Count symrefs twice, since "renaming" them is done by 821 * deleting and recreating them in two separate passes. 822 */ 823 - progress = start_progress(_("Renaming remote references"), 824 rename.remote_branches->nr + rename.symrefs_nr); 825 } 826 for (i = 0; i < remote_branches.nr; i++) {
··· 820 * Count symrefs twice, since "renaming" them is done by 821 * deleting and recreating them in two separate passes. 822 */ 823 + progress = start_progress(the_repository, 824 + _("Renaming remote references"), 825 rename.remote_branches->nr + rename.symrefs_nr); 826 } 827 for (i = 0; i < remote_branches.nr; i++) {
+2 -1
builtin/rev-list.c
··· 735 revs.limited = 1; 736 737 if (show_progress) 738 - progress = start_delayed_progress(show_progress, 0); 739 740 if (use_bitmap_index) { 741 if (!try_bitmap_count(&revs, filter_provided_objects))
··· 735 revs.limited = 1; 736 737 if (show_progress) 738 + progress = start_delayed_progress(the_repository, 739 + show_progress, 0); 740 741 if (use_bitmap_index) { 742 if (!try_bitmap_count(&revs, filter_provided_objects))
+2 -1
builtin/unpack-objects.c
··· 590 use(sizeof(struct pack_header)); 591 592 if (!quiet) 593 - progress = start_progress(_("Unpacking objects"), nr_objects); 594 CALLOC_ARRAY(obj_list, nr_objects); 595 begin_odb_transaction(); 596 for (i = 0; i < nr_objects; i++) {
··· 590 use(sizeof(struct pack_header)); 591 592 if (!quiet) 593 + progress = start_progress(the_repository, 594 + _("Unpacking objects"), nr_objects); 595 CALLOC_ARRAY(obj_list, nr_objects); 596 begin_odb_transaction(); 597 for (i = 0; i < nr_objects; i++) {
+17 -3
commit-graph.c
··· 1534 1535 if (ctx->report_progress) 1536 ctx->progress = start_delayed_progress( 1537 _("Loading known commits in commit graph"), 1538 ctx->oids.nr); 1539 for (i = 0; i < ctx->oids.nr; i++) { ··· 1551 */ 1552 if (ctx->report_progress) 1553 ctx->progress = start_delayed_progress( 1554 _("Expanding reachable commits in commit graph"), 1555 0); 1556 for (i = 0; i < ctx->oids.nr; i++) { ··· 1571 1572 if (ctx->report_progress) 1573 ctx->progress = start_delayed_progress( 1574 _("Clearing commit marks in commit graph"), 1575 ctx->oids.nr); 1576 for (i = 0; i < ctx->oids.nr; i++) { ··· 1688 if (ctx->report_progress) 1689 info.progress = ctx->progress 1690 = start_delayed_progress( 1691 _("Computing commit graph topological levels"), 1692 ctx->commits.nr); 1693 ··· 1722 if (ctx->report_progress) 1723 info.progress = ctx->progress 1724 = start_delayed_progress( 1725 _("Computing commit graph generation numbers"), 1726 ctx->commits.nr); 1727 ··· 1798 1799 if (ctx->report_progress) 1800 progress = start_delayed_progress( 1801 _("Computing commit changed paths Bloom filters"), 1802 ctx->commits.nr); 1803 ··· 1877 data.commits = &commits; 1878 if (flags & COMMIT_GRAPH_WRITE_PROGRESS) 1879 data.progress = start_delayed_progress( 1880 _("Collecting referenced commits"), 0); 1881 1882 refs_for_each_ref(get_main_ref_store(the_repository), add_ref_to_set, ··· 1908 "Finding commits for commit graph in %"PRIuMAX" packs", 1909 pack_indexes->nr), 1910 (uintmax_t)pack_indexes->nr); 1911 - ctx->progress = start_delayed_progress(progress_title.buf, 0); 1912 ctx->progress_done = 0; 1913 } 1914 for (i = 0; i < pack_indexes->nr; i++) { ··· 1959 { 1960 if (ctx->report_progress) 1961 ctx->progress = start_delayed_progress( 1962 _("Finding commits for commit graph among packed objects"), 1963 ctx->approx_nr_objects); 1964 for_each_packed_object(ctx->r, add_packed_commits, ctx, ··· 1977 ctx->num_extra_edges = 0; 1978 if (ctx->report_progress) 1979 ctx->progress = start_delayed_progress( 1980 _("Finding extra edges in commit graph"), 1981 ctx->oids.nr); 1982 oid_array_sort(&ctx->oids); ··· 2136 get_num_chunks(cf)), 2137 get_num_chunks(cf)); 2138 ctx->progress = start_delayed_progress( 2139 progress_title.buf, 2140 st_mult(get_num_chunks(cf), ctx->commits.nr)); 2141 } ··· 2348 2349 if (ctx->report_progress) 2350 ctx->progress = start_delayed_progress( 2351 _("Scanning merged commits"), 2352 ctx->commits.nr); 2353 ··· 2392 current_graph_number--; 2393 2394 if (ctx->report_progress) 2395 - ctx->progress = start_delayed_progress(_("Merging commit-graph"), 0); 2396 2397 merge_commit_graph(ctx, g); 2398 stop_progress(&ctx->progress); ··· 2874 if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW)) 2875 total += g->num_commits_in_base; 2876 2877 - progress = start_progress(_("Verifying commits in commit graph"), 2878 total); 2879 } 2880
··· 1534 1535 if (ctx->report_progress) 1536 ctx->progress = start_delayed_progress( 1537 + the_repository, 1538 _("Loading known commits in commit graph"), 1539 ctx->oids.nr); 1540 for (i = 0; i < ctx->oids.nr; i++) { ··· 1552 */ 1553 if (ctx->report_progress) 1554 ctx->progress = start_delayed_progress( 1555 + the_repository, 1556 _("Expanding reachable commits in commit graph"), 1557 0); 1558 for (i = 0; i < ctx->oids.nr; i++) { ··· 1573 1574 if (ctx->report_progress) 1575 ctx->progress = start_delayed_progress( 1576 + the_repository, 1577 _("Clearing commit marks in commit graph"), 1578 ctx->oids.nr); 1579 for (i = 0; i < ctx->oids.nr; i++) { ··· 1691 if (ctx->report_progress) 1692 info.progress = ctx->progress 1693 = start_delayed_progress( 1694 + the_repository, 1695 _("Computing commit graph topological levels"), 1696 ctx->commits.nr); 1697 ··· 1726 if (ctx->report_progress) 1727 info.progress = ctx->progress 1728 = start_delayed_progress( 1729 + the_repository, 1730 _("Computing commit graph generation numbers"), 1731 ctx->commits.nr); 1732 ··· 1803 1804 if (ctx->report_progress) 1805 progress = start_delayed_progress( 1806 + the_repository, 1807 _("Computing commit changed paths Bloom filters"), 1808 ctx->commits.nr); 1809 ··· 1883 data.commits = &commits; 1884 if (flags & COMMIT_GRAPH_WRITE_PROGRESS) 1885 data.progress = start_delayed_progress( 1886 + the_repository, 1887 _("Collecting referenced commits"), 0); 1888 1889 refs_for_each_ref(get_main_ref_store(the_repository), add_ref_to_set, ··· 1915 "Finding commits for commit graph in %"PRIuMAX" packs", 1916 pack_indexes->nr), 1917 (uintmax_t)pack_indexes->nr); 1918 + ctx->progress = start_delayed_progress(the_repository, 1919 + progress_title.buf, 0); 1920 ctx->progress_done = 0; 1921 } 1922 for (i = 0; i < pack_indexes->nr; i++) { ··· 1967 { 1968 if (ctx->report_progress) 1969 ctx->progress = start_delayed_progress( 1970 + the_repository, 1971 _("Finding commits for commit graph among packed objects"), 1972 ctx->approx_nr_objects); 1973 for_each_packed_object(ctx->r, add_packed_commits, ctx, ··· 1986 ctx->num_extra_edges = 0; 1987 if (ctx->report_progress) 1988 ctx->progress = start_delayed_progress( 1989 + the_repository, 1990 _("Finding extra edges in commit graph"), 1991 ctx->oids.nr); 1992 oid_array_sort(&ctx->oids); ··· 2146 get_num_chunks(cf)), 2147 get_num_chunks(cf)); 2148 ctx->progress = start_delayed_progress( 2149 + the_repository, 2150 progress_title.buf, 2151 st_mult(get_num_chunks(cf), ctx->commits.nr)); 2152 } ··· 2359 2360 if (ctx->report_progress) 2361 ctx->progress = start_delayed_progress( 2362 + the_repository, 2363 _("Scanning merged commits"), 2364 ctx->commits.nr); 2365 ··· 2404 current_graph_number--; 2405 2406 if (ctx->report_progress) 2407 + ctx->progress = start_delayed_progress(the_repository, 2408 + _("Merging commit-graph"), 0); 2409 2410 merge_commit_graph(ctx, g); 2411 stop_progress(&ctx->progress); ··· 2887 if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW)) 2888 total += g->num_commits_in_base; 2889 2890 + progress = start_progress(the_repository, 2891 + _("Verifying commits in commit graph"), 2892 total); 2893 } 2894
+2 -1
delta-islands.c
··· 267 QSORT(todo, nr, tree_depth_compare); 268 269 if (progress) 270 - progress_state = start_progress(_("Propagating island marks"), nr); 271 272 for (i = 0; i < nr; i++) { 273 struct object_entry *ent = todo[i].entry;
··· 267 QSORT(todo, nr, tree_depth_compare); 268 269 if (progress) 270 + progress_state = start_progress(the_repository, 271 + _("Propagating island marks"), nr); 272 273 for (i = 0; i < nr; i++) { 274 struct object_entry *ent = todo[i].entry;
+1
diffcore-rename.c
··· 1567 trace2_region_enter("diff", "inexact renames", options->repo); 1568 if (options->show_rename_progress) { 1569 progress = start_delayed_progress( 1570 _("Performing inexact rename detection"), 1571 (uint64_t)num_destinations * (uint64_t)num_sources); 1572 }
··· 1567 trace2_region_enter("diff", "inexact renames", options->repo); 1568 if (options->show_rename_progress) { 1569 progress = start_delayed_progress( 1570 + the_repository, 1571 _("Performing inexact rename detection"), 1572 (uint64_t)num_destinations * (uint64_t)num_sources); 1573 }
+3 -1
entry.c
··· 188 189 dco->state = CE_RETRY; 190 if (show_progress) 191 - progress = start_delayed_progress(_("Filtering content"), dco->paths.nr); 192 while (dco->filters.nr > 0) { 193 for_each_string_list_item(filter, &dco->filters) { 194 struct string_list available_paths = STRING_LIST_INIT_DUP;
··· 188 189 dco->state = CE_RETRY; 190 if (show_progress) 191 + progress = start_delayed_progress(the_repository, 192 + _("Filtering content"), 193 + dco->paths.nr); 194 while (dco->filters.nr > 0) { 195 for_each_string_list_item(filter, &dco->filters) { 196 struct string_list available_paths = STRING_LIST_INIT_DUP;
+8 -3
midx-write.c
··· 1131 1132 ctx.pack_paths_checked = 0; 1133 if (flags & MIDX_PROGRESS) 1134 - ctx.progress = start_delayed_progress(_("Adding packfiles to multi-pack-index"), 0); 1135 else 1136 ctx.progress = NULL; 1137 ··· 1539 CALLOC_ARRAY(count, m->num_packs); 1540 1541 if (flags & MIDX_PROGRESS) 1542 - progress = start_delayed_progress(_("Counting referenced objects"), 1543 m->num_objects); 1544 for (i = 0; i < m->num_objects; i++) { 1545 int pack_int_id = nth_midxed_pack_int_id(m, i); ··· 1549 stop_progress(&progress); 1550 1551 if (flags & MIDX_PROGRESS) 1552 - progress = start_delayed_progress(_("Finding and deleting unreferenced packfiles"), 1553 m->num_packs); 1554 for (i = 0; i < m->num_packs; i++) { 1555 char *pack_name;
··· 1131 1132 ctx.pack_paths_checked = 0; 1133 if (flags & MIDX_PROGRESS) 1134 + ctx.progress = start_delayed_progress(r, 1135 + _("Adding packfiles to multi-pack-index"), 0); 1136 else 1137 ctx.progress = NULL; 1138 ··· 1540 CALLOC_ARRAY(count, m->num_packs); 1541 1542 if (flags & MIDX_PROGRESS) 1543 + progress = start_delayed_progress( 1544 + r, 1545 + _("Counting referenced objects"), 1546 m->num_objects); 1547 for (i = 0; i < m->num_objects; i++) { 1548 int pack_int_id = nth_midxed_pack_int_id(m, i); ··· 1552 stop_progress(&progress); 1553 1554 if (flags & MIDX_PROGRESS) 1555 + progress = start_delayed_progress( 1556 + r, 1557 + _("Finding and deleting unreferenced packfiles"), 1558 m->num_packs); 1559 for (i = 0; i < m->num_packs; i++) { 1560 char *pack_name;
+9 -4
midx.c
··· 907 midx_report(_("incorrect checksum")); 908 909 if (flags & MIDX_PROGRESS) 910 - progress = start_delayed_progress(_("Looking for referenced packfiles"), 911 m->num_packs + m->num_packs_in_base); 912 for (i = 0; i < m->num_packs + m->num_packs_in_base; i++) { 913 if (prepare_midx_pack(r, m, i)) ··· 927 } 928 929 if (flags & MIDX_PROGRESS) 930 - progress = start_sparse_progress(_("Verifying OID order in multi-pack-index"), 931 m->num_objects - 1); 932 933 for (curr = m; curr; curr = curr->base_midx) { ··· 959 } 960 961 if (flags & MIDX_PROGRESS) 962 - progress = start_sparse_progress(_("Sorting objects by packfile"), 963 m->num_objects); 964 display_progress(progress, 0); /* TODO: Measure QSORT() progress */ 965 QSORT(pairs, m->num_objects, compare_pair_pos_vs_id); 966 stop_progress(&progress); 967 968 if (flags & MIDX_PROGRESS) 969 - progress = start_sparse_progress(_("Verifying object offsets"), m->num_objects); 970 for (i = 0; i < m->num_objects + m->num_objects_in_base; i++) { 971 struct object_id oid; 972 struct pack_entry e;
··· 907 midx_report(_("incorrect checksum")); 908 909 if (flags & MIDX_PROGRESS) 910 + progress = start_delayed_progress(r, 911 + _("Looking for referenced packfiles"), 912 m->num_packs + m->num_packs_in_base); 913 for (i = 0; i < m->num_packs + m->num_packs_in_base; i++) { 914 if (prepare_midx_pack(r, m, i)) ··· 928 } 929 930 if (flags & MIDX_PROGRESS) 931 + progress = start_sparse_progress(r, 932 + _("Verifying OID order in multi-pack-index"), 933 m->num_objects - 1); 934 935 for (curr = m; curr; curr = curr->base_midx) { ··· 961 } 962 963 if (flags & MIDX_PROGRESS) 964 + progress = start_sparse_progress(r, 965 + _("Sorting objects by packfile"), 966 m->num_objects); 967 display_progress(progress, 0); /* TODO: Measure QSORT() progress */ 968 QSORT(pairs, m->num_objects, compare_pair_pos_vs_id); 969 stop_progress(&progress); 970 971 if (flags & MIDX_PROGRESS) 972 + progress = start_sparse_progress(r, 973 + _("Verifying object offsets"), 974 + m->num_objects); 975 for (i = 0; i < m->num_objects + m->num_objects_in_base; i++) { 976 struct object_id oid; 977 struct pack_entry e;
+4 -2
pack-bitmap-write.c
··· 590 int closed = 1; /* until proven otherwise */ 591 592 if (writer->show_progress) 593 - writer->progress = start_progress("Building bitmaps", 594 writer->selected_nr); 595 trace2_region_enter("pack-bitmap-write", "building_bitmaps_total", 596 the_repository); ··· 710 } 711 712 if (writer->show_progress) 713 - writer->progress = start_progress("Selecting bitmap commits", 0); 714 715 for (;;) { 716 struct commit *chosen = NULL;
··· 590 int closed = 1; /* until proven otherwise */ 591 592 if (writer->show_progress) 593 + writer->progress = start_progress(the_repository, 594 + "Building bitmaps", 595 writer->selected_nr); 596 trace2_region_enter("pack-bitmap-write", "building_bitmaps_total", 597 the_repository); ··· 711 } 712 713 if (writer->show_progress) 714 + writer->progress = start_progress(the_repository, 715 + "Selecting bitmap commits", 0); 716 717 for (;;) { 718 struct commit *chosen = NULL;
+3 -1
pack-bitmap.c
··· 2578 tdata.trees = ewah_to_bitmap(bitmap_git->trees); 2579 tdata.blobs = ewah_to_bitmap(bitmap_git->blobs); 2580 tdata.tags = ewah_to_bitmap(bitmap_git->tags); 2581 - tdata.prg = start_progress("Verifying bitmap entries", result_popcnt); 2582 tdata.seen = 0; 2583 2584 traverse_commit_list(revs, &test_show_commit, &test_show_object, &tdata);
··· 2578 tdata.trees = ewah_to_bitmap(bitmap_git->trees); 2579 tdata.blobs = ewah_to_bitmap(bitmap_git->blobs); 2580 tdata.tags = ewah_to_bitmap(bitmap_git->tags); 2581 + tdata.prg = start_progress(revs->repo, 2582 + "Verifying bitmap entries", 2583 + result_popcnt); 2584 tdata.seen = 0; 2585 2586 traverse_commit_list(revs, &test_show_commit, &test_show_object, &tdata);
+3 -1
preload-index.c
··· 132 133 memset(&pd, 0, sizeof(pd)); 134 if (refresh_flags & REFRESH_PROGRESS && isatty(2)) { 135 - pd.progress = start_delayed_progress(_("Refreshing index"), index->cache_nr); 136 pthread_mutex_init(&pd.mutex, NULL); 137 } 138
··· 132 133 memset(&pd, 0, sizeof(pd)); 134 if (refresh_flags & REFRESH_PROGRESS && isatty(2)) { 135 + pd.progress = start_delayed_progress(the_repository, 136 + _("Refreshing index"), 137 + index->cache_nr); 138 pthread_mutex_init(&pd.mutex, NULL); 139 } 140
+20 -14
progress.c
··· 9 */ 10 11 #define GIT_TEST_PROGRESS_ONLY 12 - #define USE_THE_REPOSITORY_VARIABLE 13 #define DISABLE_SIGN_COMPARE_WARNINGS 14 15 #include "git-compat-util.h" ··· 37 }; 38 39 struct progress { 40 const char *title; 41 uint64_t last_value; 42 uint64_t total; ··· 254 display(progress, n, NULL); 255 } 256 257 - static struct progress *start_progress_delay(const char *title, uint64_t total, 258 unsigned delay, unsigned sparse) 259 { 260 struct progress *progress = xmalloc(sizeof(*progress)); 261 progress->title = title; 262 progress->total = total; 263 progress->last_value = -1; ··· 270 progress->title_len = utf8_strwidth(title); 271 progress->split = 0; 272 set_progress_signal(); 273 - trace2_region_enter("progress", title, the_repository); 274 return progress; 275 } 276 ··· 284 return delay_in_secs; 285 } 286 287 - struct progress *start_delayed_progress(const char *title, uint64_t total) 288 { 289 - return start_progress_delay(title, total, get_default_delay(), 0); 290 } 291 292 - struct progress *start_progress(const char *title, uint64_t total) 293 { 294 - return start_progress_delay(title, total, 0, 0); 295 } 296 297 /* ··· 303 * When "sparse" is set, stop_progress() will automatically force the done 304 * message to show 100%. 305 */ 306 - struct progress *start_sparse_progress(const char *title, uint64_t total) 307 { 308 - return start_progress_delay(title, total, 0, 1); 309 } 310 311 - struct progress *start_delayed_sparse_progress(const char *title, 312 uint64_t total) 313 { 314 - return start_progress_delay(title, total, get_default_delay(), 1); 315 } 316 317 static void finish_if_sparse(struct progress *progress) ··· 341 342 static void log_trace2(struct progress *progress) 343 { 344 - trace2_data_intmax("progress", the_repository, "total_objects", 345 progress->total); 346 347 if (progress->throughput) 348 - trace2_data_intmax("progress", the_repository, "total_bytes", 349 progress->throughput->curr_total); 350 351 - trace2_region_leave("progress", progress->title, the_repository); 352 } 353 354 void stop_progress_msg(struct progress **p_progress, const char *msg)
··· 9 */ 10 11 #define GIT_TEST_PROGRESS_ONLY 12 #define DISABLE_SIGN_COMPARE_WARNINGS 13 14 #include "git-compat-util.h" ··· 36 }; 37 38 struct progress { 39 + struct repository *repo; 40 const char *title; 41 uint64_t last_value; 42 uint64_t total; ··· 254 display(progress, n, NULL); 255 } 256 257 + static struct progress *start_progress_delay(struct repository *r, 258 + const char *title, uint64_t total, 259 unsigned delay, unsigned sparse) 260 { 261 struct progress *progress = xmalloc(sizeof(*progress)); 262 + progress->repo = r; 263 progress->title = title; 264 progress->total = total; 265 progress->last_value = -1; ··· 272 progress->title_len = utf8_strwidth(title); 273 progress->split = 0; 274 set_progress_signal(); 275 + trace2_region_enter("progress", title, r); 276 return progress; 277 } 278 ··· 286 return delay_in_secs; 287 } 288 289 + struct progress *start_delayed_progress(struct repository *r, 290 + const char *title, uint64_t total) 291 { 292 + return start_progress_delay(r, title, total, get_default_delay(), 0); 293 } 294 295 + struct progress *start_progress(struct repository *r, 296 + const char *title, uint64_t total) 297 { 298 + return start_progress_delay(r, title, total, 0, 0); 299 } 300 301 /* ··· 307 * When "sparse" is set, stop_progress() will automatically force the done 308 * message to show 100%. 309 */ 310 + struct progress *start_sparse_progress(struct repository *r, 311 + const char *title, uint64_t total) 312 { 313 + return start_progress_delay(r, title, total, 0, 1); 314 } 315 316 + struct progress *start_delayed_sparse_progress(struct repository *r, 317 + const char *title, 318 uint64_t total) 319 { 320 + return start_progress_delay(r, title, total, get_default_delay(), 1); 321 } 322 323 static void finish_if_sparse(struct progress *progress) ··· 347 348 static void log_trace2(struct progress *progress) 349 { 350 + trace2_data_intmax("progress", progress->repo, "total_objects", 351 progress->total); 352 353 if (progress->throughput) 354 + trace2_data_intmax("progress", progress->repo, "total_bytes", 355 progress->throughput->curr_total); 356 357 + trace2_region_leave("progress", progress->title, progress->repo); 358 } 359 360 void stop_progress_msg(struct progress **p_progress, const char *msg)
+9 -4
progress.h
··· 3 #include "gettext.h" 4 5 struct progress; 6 7 #ifdef GIT_TEST_PROGRESS_ONLY 8 ··· 14 15 void display_throughput(struct progress *progress, uint64_t total); 16 void display_progress(struct progress *progress, uint64_t n); 17 - struct progress *start_progress(const char *title, uint64_t total); 18 - struct progress *start_sparse_progress(const char *title, uint64_t total); 19 - struct progress *start_delayed_progress(const char *title, uint64_t total); 20 - struct progress *start_delayed_sparse_progress(const char *title, 21 uint64_t total); 22 void stop_progress_msg(struct progress **p_progress, const char *msg); 23 static inline void stop_progress(struct progress **p_progress)
··· 3 #include "gettext.h" 4 5 struct progress; 6 + struct repository; 7 8 #ifdef GIT_TEST_PROGRESS_ONLY 9 ··· 15 16 void display_throughput(struct progress *progress, uint64_t total); 17 void display_progress(struct progress *progress, uint64_t n); 18 + struct progress *start_progress(struct repository *r, 19 + const char *title, uint64_t total); 20 + struct progress *start_sparse_progress(struct repository *r, 21 + const char *title, uint64_t total); 22 + struct progress *start_delayed_progress(struct repository *r, 23 + const char *title, uint64_t total); 24 + struct progress *start_delayed_sparse_progress(struct repository *r, 25 + const char *title, 26 uint64_t total); 27 void stop_progress_msg(struct progress **p_progress, const char *msg); 28 static inline void stop_progress(struct progress **p_progress)
+2 -1
prune-packed.c
··· 37 void prune_packed_objects(int opts) 38 { 39 if (opts & PRUNE_PACKED_VERBOSE) 40 - progress = start_delayed_progress(_("Removing duplicate objects"), 256); 41 42 for_each_loose_file_in_objdir(repo_get_object_directory(the_repository), 43 prune_object, NULL, prune_subdir, &opts);
··· 37 void prune_packed_objects(int opts) 38 { 39 if (opts & PRUNE_PACKED_VERBOSE) 40 + progress = start_delayed_progress(the_repository, 41 + _("Removing duplicate objects"), 256); 42 43 for_each_loose_file_in_objdir(repo_get_object_directory(the_repository), 44 prune_object, NULL, prune_subdir, &opts);
+2 -1
pseudo-merge.c
··· 459 return; 460 461 if (writer->show_progress) 462 - progress = start_progress("Selecting pseudo-merge commits", 463 writer->pseudo_merge_groups.nr); 464 465 refs_for_each_ref(get_main_ref_store(the_repository),
··· 459 return; 460 461 if (writer->show_progress) 462 + progress = start_progress(the_repository, 463 + "Selecting pseudo-merge commits", 464 writer->pseudo_merge_groups.nr); 465 466 refs_for_each_ref(get_main_ref_store(the_repository),
+2 -1
read-cache.c
··· 1523 int t2_sum_scan = 0; 1524 1525 if (flags & REFRESH_PROGRESS && isatty(2)) 1526 - progress = start_delayed_progress(_("Refresh index"), 1527 istate->cache_nr); 1528 1529 trace_performance_enter();
··· 1523 int t2_sum_scan = 0; 1524 1525 if (flags & REFRESH_PROGRESS && isatty(2)) 1526 + progress = start_delayed_progress(the_repository, 1527 + _("Refresh index"), 1528 istate->cache_nr); 1529 1530 trace_performance_enter();
+5 -1
t/helper/test-progress.c
··· 17 * 18 * See 't0500-progress-display.sh' for examples. 19 */ 20 #define GIT_TEST_PROGRESS_ONLY 21 #include "test-tool.h" 22 #include "parse-options.h" 23 #include "progress.h" 24 #include "strbuf.h" 25 #include "string-list.h" 26 ··· 64 else 65 die("invalid input: '%s'", line.buf); 66 67 - progress = start_progress(title, total); 68 } else if (skip_prefix(line.buf, "progress ", (const char **) &end)) { 69 uint64_t item_count = strtoull(end, &end, 10); 70 if (*end != '\0')
··· 17 * 18 * See 't0500-progress-display.sh' for examples. 19 */ 20 + 21 + #define USE_THE_REPOSITORY_VARIABLE 22 #define GIT_TEST_PROGRESS_ONLY 23 + 24 #include "test-tool.h" 25 #include "parse-options.h" 26 #include "progress.h" 27 + #include "repository.h" 28 #include "strbuf.h" 29 #include "string-list.h" 30 ··· 68 else 69 die("invalid input: '%s'", line.buf); 70 71 + progress = start_progress(the_repository, title, total); 72 } else if (skip_prefix(line.buf, "progress ", (const char **) &end)) { 73 uint64_t item_count = strtoull(end, &end, 10); 74 if (*end != '\0')
+3 -1
unpack-trees.c
··· 372 total++; 373 } 374 375 - return start_delayed_progress(_("Updating files"), total); 376 } 377 378 static void setup_collided_checkout_detection(struct checkout *state, ··· 1773 strbuf_reset(&prefix); 1774 if (show_progress) 1775 istate->progress = start_delayed_progress( 1776 _("Updating index flags"), 1777 istate->cache_nr); 1778
··· 372 total++; 373 } 374 375 + return start_delayed_progress(the_repository, 376 + _("Updating files"), total); 377 } 378 379 static void setup_collided_checkout_detection(struct checkout *state, ··· 1774 strbuf_reset(&prefix); 1775 if (show_progress) 1776 istate->progress = start_delayed_progress( 1777 + the_repository, 1778 _("Updating index flags"), 1779 istate->cache_nr); 1780
+2 -1
walker.c
··· 172 uint64_t nr = 0; 173 174 if (walker->get_progress) 175 - progress = start_delayed_progress(_("Fetching objects"), 0); 176 177 while (process_queue) { 178 struct object *obj = process_queue->item;
··· 172 uint64_t nr = 0; 173 174 if (walker->get_progress) 175 + progress = start_delayed_progress(the_repository, 176 + _("Fetching objects"), 0); 177 178 while (process_queue) { 179 struct object *obj = process_queue->item;