Git fork

Merge branch 'ps/the-repository'

More code paths have a repository passed through the callchain,
instead of assuming the primary the_repository object.

* ps/the-repository:
match-trees: stop using `the_repository`
graph: stop using `the_repository`
add-interactive: stop using `the_repository`
tmp-objdir: stop using `the_repository`
resolve-undo: stop using `the_repository`
credential: stop using `the_repository`
mailinfo: stop using `the_repository`
diagnose: stop using `the_repository`
server-info: stop using `the_repository`
send-pack: stop using `the_repository`
serve: stop using `the_repository`
trace: stop using `the_repository`
pager: stop using `the_repository`
progress: stop using `the_repository`

+407 -299
+9 -10
add-interactive.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 72 71 s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN); 73 72 74 73 FREE_AND_NULL(s->interactive_diff_filter); 75 - git_config_get_string("interactive.difffilter", 76 - &s->interactive_diff_filter); 74 + repo_config_get_string(r, "interactive.difffilter", 75 + &s->interactive_diff_filter); 77 76 78 77 FREE_AND_NULL(s->interactive_diff_algorithm); 79 - git_config_get_string("diff.algorithm", 80 - &s->interactive_diff_algorithm); 78 + repo_config_get_string(r, "diff.algorithm", 79 + &s->interactive_diff_algorithm); 81 80 82 - git_config_get_bool("interactive.singlekey", &s->use_single_key); 81 + repo_config_get_bool(r, "interactive.singlekey", &s->use_single_key); 83 82 if (s->use_single_key) 84 83 setbuf(stdin, NULL); 85 84 } ··· 535 534 size_t *binary_count) 536 535 { 537 536 struct object_id head_oid; 538 - int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository), 537 + int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(r), 539 538 "HEAD", RESOLVE_REF_READING, 540 539 &head_oid, NULL); 541 540 struct collection_status s = { 0 }; ··· 560 559 s.skip_unseen = filter && i; 561 560 562 561 opt.def = is_initial ? 563 - empty_tree_oid_hex(the_repository->hash_algo) : oid_to_hex(&head_oid); 562 + empty_tree_oid_hex(r->hash_algo) : oid_to_hex(&head_oid); 564 563 565 564 repo_init_revisions(r, &rev, NULL); 566 565 setup_revisions(0, NULL, &rev, &opt); ··· 765 764 size_t count, i, j; 766 765 767 766 struct object_id oid; 768 - int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository), 767 + int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r), 769 768 "HEAD", RESOLVE_REF_READING, 770 769 &oid, 771 770 NULL); ··· 996 995 ssize_t count, i; 997 996 998 997 struct object_id oid; 999 - int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository), 998 + int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r), 1000 999 "HEAD", RESOLVE_REF_READING, 1001 1000 &oid, 1002 1001 NULL);
+1 -1
add-patch.c
··· 1464 1464 if (file_diff->hunk_nr) { 1465 1465 if (rendered_hunk_index != hunk_index) { 1466 1466 if (use_pager) { 1467 - setup_pager(); 1467 + setup_pager(the_repository); 1468 1468 sigchain_push(SIGPIPE, SIG_IGN); 1469 1469 } 1470 1470 render_hunk(s, hunk, 0, colored, &s->buf);
+3 -3
builtin/am.c
··· 1211 1211 int ret = 0; 1212 1212 struct mailinfo mi; 1213 1213 1214 - setup_mailinfo(&mi); 1214 + setup_mailinfo(the_repository, &mi); 1215 1215 1216 1216 if (state->utf8) 1217 1217 mi.metainfo_charset = get_commit_output_encoding(); ··· 1786 1786 } 1787 1787 strbuf_release(&msg); 1788 1788 } else if (*reply == 'v' || *reply == 'V') { 1789 - const char *pager = git_pager(1); 1789 + const char *pager = git_pager(the_repository, 1); 1790 1790 struct child_process cp = CHILD_PROCESS_INIT; 1791 1791 1792 1792 if (!pager) ··· 2246 2246 if (len < 0) 2247 2247 die_errno(_("failed to read '%s'"), patch_path); 2248 2248 2249 - setup_pager(); 2249 + setup_pager(the_repository); 2250 2250 write_in_full(1, sb.buf, sb.len); 2251 2251 strbuf_release(&sb); 2252 2252 return 0;
+4 -2
builtin/blame.c
··· 1194 1194 sb.found_guilty_entry = &found_guilty_entry; 1195 1195 sb.found_guilty_entry_data = &pi; 1196 1196 if (show_progress) 1197 - pi.progress = start_delayed_progress(_("Blaming lines"), num_lines); 1197 + pi.progress = start_delayed_progress(the_repository, 1198 + _("Blaming lines"), 1199 + num_lines); 1198 1200 1199 1201 assign_blame(&sb, opt); 1200 1202 1201 1203 stop_progress(&pi.progress); 1202 1204 1203 1205 if (!incremental) 1204 - setup_pager(); 1206 + setup_pager(the_repository); 1205 1207 else 1206 1208 goto cleanup; 1207 1209
+1 -1
builtin/bugreport.c
··· 167 167 strbuf_addftime(&zip_path, option_suffix, localtime_r(&now, &tm), 0, 0); 168 168 strbuf_addstr(&zip_path, ".zip"); 169 169 170 - if (create_diagnostics_archive(&zip_path, diagnose)) 170 + if (create_diagnostics_archive(the_repository, &zip_path, diagnose)) 171 171 die_errno(_("unable to create diagnostics archive %s"), zip_path.buf); 172 172 173 173 strbuf_release(&zip_path);
+1
builtin/commit-graph.c
··· 305 305 oidset_init(&commits, 0); 306 306 if (opts.progress) 307 307 progress = start_delayed_progress( 308 + the_repository, 308 309 _("Collecting commits from input"), 0); 309 310 310 311 while (strbuf_getline(&buf, stdin) != EOF) {
+3 -3
builtin/credential.c
··· 32 32 die("unable to read credential from stdin"); 33 33 34 34 if (!strcmp(op, "fill")) { 35 - credential_fill(&c, 0); 35 + credential_fill(the_repository, &c, 0); 36 36 credential_next_state(&c); 37 37 credential_write(&c, stdout, CREDENTIAL_OP_RESPONSE); 38 38 } else if (!strcmp(op, "approve")) { 39 39 credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER); 40 - credential_approve(&c); 40 + credential_approve(the_repository, &c); 41 41 } else if (!strcmp(op, "reject")) { 42 42 credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER); 43 - credential_reject(&c); 43 + credential_reject(the_repository, &c); 44 44 } else { 45 45 usage(usage_msg); 46 46 }
+3 -1
builtin/diagnose.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "builtin.h" 2 4 #include "abspath.h" 3 5 #include "gettext.h" ··· 58 60 } 59 61 60 62 /* Prepare diagnostics */ 61 - if (create_diagnostics_archive(&zip_path, mode)) 63 + if (create_diagnostics_archive(the_repository, &zip_path, mode)) 62 64 die_errno(_("unable to create diagnostics archive %s"), 63 65 zip_path.buf); 64 66
+8 -4
builtin/fsck.c
··· 197 197 unsigned int nr = 0; 198 198 int result = 0; 199 199 if (show_progress) 200 - progress = start_delayed_progress(_("Checking connectivity"), 0); 200 + progress = start_delayed_progress(the_repository, 201 + _("Checking connectivity"), 0); 201 202 while (pending.nr) { 202 203 result |= traverse_one_object(object_array_pop(&pending)); 203 204 display_progress(progress, ++nr); ··· 703 704 fprintf_ln(stderr, _("Checking object directory")); 704 705 705 706 if (show_progress) 706 - progress = start_progress(_("Checking object directories"), 256); 707 + progress = start_progress(the_repository, 708 + _("Checking object directories"), 256); 707 709 708 710 for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir, 709 711 &cb_data); ··· 879 881 if (show_progress) { 880 882 for (struct packed_git *p = get_all_packs(r); p; p = p->next) 881 883 pack_count++; 882 - progress = start_delayed_progress("Verifying reverse pack-indexes", pack_count); 884 + progress = start_delayed_progress(the_repository, 885 + "Verifying reverse pack-indexes", pack_count); 883 886 pack_count = 0; 884 887 } 885 888 ··· 989 992 total += p->num_objects; 990 993 } 991 994 992 - progress = start_progress(_("Checking objects"), total); 995 + progress = start_progress(the_repository, 996 + _("Checking objects"), total); 993 997 } 994 998 for (p = get_all_packs(the_repository); p; 995 999 p = p->next) {
+2 -2
builtin/grep.c
··· 1084 1084 } 1085 1085 1086 1086 if (show_in_pager == default_pager) 1087 - show_in_pager = git_pager(1); 1087 + show_in_pager = git_pager(the_repository, 1); 1088 1088 if (show_in_pager) { 1089 1089 opt.color = 0; 1090 1090 opt.name_only = 1; ··· 1246 1246 } 1247 1247 1248 1248 if (!show_in_pager && !opt.status_only) 1249 - setup_pager(); 1249 + setup_pager(the_repository); 1250 1250 1251 1251 die_for_incompatible_opt3(!use_index, "--no-index", 1252 1252 untracked, "--untracked",
+2 -2
builtin/help.c
··· 658 658 case HELP_ACTION_ALL: 659 659 opt_mode_usage(argc, "--all", help_format); 660 660 if (verbose) { 661 - setup_pager(); 661 + setup_pager(the_repository); 662 662 list_all_cmds_help(show_external_commands, 663 663 show_aliases); 664 664 return 0; ··· 692 692 return 0; 693 693 case HELP_ACTION_CONFIG: 694 694 opt_mode_usage(argc, "--config", help_format); 695 - setup_pager(); 695 + setup_pager(the_repository); 696 696 list_config_help(SHOW_CONFIG_HUMAN); 697 697 printf("\n%s\n", _("'git help config' for more information")); 698 698 return 0;
+5 -2
builtin/index-pack.c
··· 282 282 max = get_max_object_index(); 283 283 284 284 if (verbose) 285 - progress = start_delayed_progress(_("Checking objects"), max); 285 + progress = start_delayed_progress(the_repository, 286 + _("Checking objects"), max); 286 287 287 288 for (i = 0; i < max; i++) { 288 289 foreign_nr += check_object(get_indexed_object(i)); ··· 1249 1250 1250 1251 if (verbose) 1251 1252 progress = start_progress( 1253 + the_repository, 1252 1254 progress_title ? progress_title : 1253 1255 from_stdin ? _("Receiving objects") : _("Indexing objects"), 1254 1256 nr_objects); ··· 1329 1331 QSORT(ref_deltas, nr_ref_deltas, compare_ref_delta_entry); 1330 1332 1331 1333 if (verbose || show_resolving_progress) 1332 - progress = start_progress(_("Resolving deltas"), 1334 + progress = start_progress(the_repository, 1335 + _("Resolving deltas"), 1333 1336 nr_ref_deltas + nr_ofs_deltas); 1334 1337 1335 1338 nr_dispatched = 0;
+4 -3
builtin/log.c
··· 367 367 if (rev->line_level_traverse) 368 368 line_log_init(rev, line_cb.prefix, &line_cb.args); 369 369 370 - setup_pager(); 370 + setup_pager(the_repository); 371 371 } 372 372 373 373 static void cmd_log_init(int argc, const char **argv, const char *prefix, ··· 2295 2295 rev.commit_format = CMIT_FMT_MBOXRD; 2296 2296 2297 2297 if (use_stdout) { 2298 - setup_pager(); 2298 + setup_pager(the_repository); 2299 2299 } else if (!rev.diffopt.close_file) { 2300 2300 int saved; 2301 2301 ··· 2498 2498 rev.add_signoff = cfg.do_signoff; 2499 2499 2500 2500 if (show_progress) 2501 - progress = start_delayed_progress(_("Generating patches"), total); 2501 + progress = start_delayed_progress(the_repository, 2502 + _("Generating patches"), total); 2502 2503 for (i = 0; i < nr; i++) { 2503 2504 size_t idx = nr - i - 1; 2504 2505 int shown;
+1 -1
builtin/mailinfo.c
··· 83 83 OPT_END() 84 84 }; 85 85 86 - setup_mailinfo(&mi); 86 + setup_mailinfo(the_repository, &mi); 87 87 meta_charset.policy = CHARSET_DEFAULT; 88 88 89 89 argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);
+14 -7
builtin/pack-objects.c
··· 1264 1264 struct object_entry **write_order; 1265 1265 1266 1266 if (progress > pack_to_stdout) 1267 - progress_state = start_progress(_("Writing objects"), nr_result); 1267 + progress_state = start_progress(the_repository, 1268 + _("Writing objects"), nr_result); 1268 1269 ALLOC_ARRAY(written_list, to_pack.nr_objects); 1269 1270 write_order = compute_write_order(); 1270 1271 ··· 2400 2401 struct object_entry **sorted_by_offset; 2401 2402 2402 2403 if (progress) 2403 - progress_state = start_progress(_("Counting objects"), 2404 + progress_state = start_progress(the_repository, 2405 + _("Counting objects"), 2404 2406 to_pack.nr_objects); 2405 2407 2406 2408 CALLOC_ARRAY(sorted_by_offset, to_pack.nr_objects); ··· 3220 3222 unsigned nr_done = 0; 3221 3223 3222 3224 if (progress) 3223 - progress_state = start_progress(_("Compressing objects"), 3225 + progress_state = start_progress(the_repository, 3226 + _("Compressing objects"), 3224 3227 nr_deltas); 3225 3228 QSORT(delta_list, n, type_size_sort); 3226 3229 ll_find_deltas(delta_list, n, window+1, depth, &nr_done); ··· 3648 3651 static void enumerate_cruft_objects(void) 3649 3652 { 3650 3653 if (progress) 3651 - progress_state = start_progress(_("Enumerating cruft objects"), 0); 3654 + progress_state = start_progress(the_repository, 3655 + _("Enumerating cruft objects"), 0); 3652 3656 3653 3657 add_objects_in_unpacked_packs(); 3654 3658 add_unreachable_loose_objects(); ··· 3674 3678 revs.ignore_missing_links = 1; 3675 3679 3676 3680 if (progress) 3677 - progress_state = start_progress(_("Enumerating cruft objects"), 0); 3681 + progress_state = start_progress(the_repository, 3682 + _("Enumerating cruft objects"), 0); 3678 3683 ret = add_unseen_recent_objects_to_traversal(&revs, cruft_expiration, 3679 3684 set_cruft_mtime, 1); 3680 3685 stop_progress(&progress_state); ··· 3693 3698 if (prepare_revision_walk(&revs)) 3694 3699 die(_("revision walk setup failed")); 3695 3700 if (progress) 3696 - progress_state = start_progress(_("Traversing cruft objects"), 0); 3701 + progress_state = start_progress(the_repository, 3702 + _("Traversing cruft objects"), 0); 3697 3703 nr_seen = 0; 3698 3704 traverse_commit_list(&revs, show_cruft_commit, show_cruft_object, NULL); 3699 3705 ··· 4625 4631 prepare_packing_data(the_repository, &to_pack); 4626 4632 4627 4633 if (progress && !cruft) 4628 - progress_state = start_progress(_("Enumerating objects"), 0); 4634 + progress_state = start_progress(the_repository, 4635 + _("Enumerating objects"), 0); 4629 4636 if (stdin_packs) { 4630 4637 /* avoids adding objects in excluded packs */ 4631 4638 ignore_packed_keep_in_core = 1;
+2 -1
builtin/prune.c
··· 64 64 return; 65 65 66 66 if (show_progress) 67 - progress = start_delayed_progress(_("Checking connectivity"), 0); 67 + progress = start_delayed_progress(the_repository, 68 + _("Checking connectivity"), 0); 68 69 mark_reachable_objects(revs, 1, expire, progress); 69 70 stop_progress(&progress); 70 71 initialized = 1;
+2 -2
builtin/receive-pack.c
··· 2239 2239 strvec_push(&child.args, alt_shallow_file); 2240 2240 } 2241 2241 2242 - tmp_objdir = tmp_objdir_create("incoming"); 2242 + tmp_objdir = tmp_objdir_create(the_repository, "incoming"); 2243 2243 if (!tmp_objdir) { 2244 2244 if (err_fd > 0) 2245 2245 close(err_fd); ··· 2628 2628 } 2629 2629 } 2630 2630 if (auto_update_server_info) 2631 - update_server_info(0); 2631 + update_server_info(the_repository, 0); 2632 2632 clear_shallow_info(&si); 2633 2633 } 2634 2634 if (use_sideband)
+2 -1
builtin/remote.c
··· 820 820 * Count symrefs twice, since "renaming" them is done by 821 821 * deleting and recreating them in two separate passes. 822 822 */ 823 - progress = start_progress(_("Renaming remote references"), 823 + progress = start_progress(the_repository, 824 + _("Renaming remote references"), 824 825 rename.remote_branches->nr + rename.symrefs_nr); 825 826 } 826 827 for (i = 0; i < remote_branches.nr; i++) {
+1 -1
builtin/repack.c
··· 1565 1565 } 1566 1566 1567 1567 if (run_update_server_info) 1568 - update_server_info(0); 1568 + update_server_info(the_repository, 0); 1569 1569 1570 1570 if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) { 1571 1571 unsigned flags = 0;
+2 -1
builtin/rev-list.c
··· 735 735 revs.limited = 1; 736 736 737 737 if (show_progress) 738 - progress = start_delayed_progress(show_progress, 0); 738 + progress = start_delayed_progress(the_repository, 739 + show_progress, 0); 739 740 740 741 if (use_bitmap_index) { 741 742 if (!try_bitmap_count(&revs, filter_provided_objects))
+1 -1
builtin/send-pack.c
··· 317 317 set_ref_status_for_push(remote_refs, args.send_mirror, 318 318 args.force_update); 319 319 320 - ret = send_pack(&args, fd, conn, remote_refs, &extra_have); 320 + ret = send_pack(the_repository, &args, fd, conn, remote_refs, &extra_have); 321 321 322 322 if (helper_status) 323 323 print_helper_status(remote_refs);
+2 -1
builtin/unpack-objects.c
··· 590 590 use(sizeof(struct pack_header)); 591 591 592 592 if (!quiet) 593 - progress = start_progress(_("Unpacking objects"), nr_objects); 593 + progress = start_progress(the_repository, 594 + _("Unpacking objects"), nr_objects); 594 595 CALLOC_ARRAY(obj_list, nr_objects); 595 596 begin_odb_transaction(); 596 597 for (i = 0; i < nr_objects; i++) {
+1 -1
builtin/update-server-info.c
··· 27 27 if (argc > 0) 28 28 usage_with_options(update_server_info_usage, options); 29 29 30 - return !!update_server_info(force); 30 + return !!update_server_info(the_repository, force); 31 31 }
+4 -2
builtin/upload-pack.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "builtin.h" 2 4 #include "exec-cmd.h" 3 5 #include "gettext.h" ··· 63 65 switch (determine_protocol_version_server()) { 64 66 case protocol_v2: 65 67 if (advertise_refs) 66 - protocol_v2_advertise_capabilities(); 68 + protocol_v2_advertise_capabilities(the_repository); 67 69 else 68 - protocol_v2_serve_loop(stateless_rpc); 70 + protocol_v2_serve_loop(the_repository, stateless_rpc); 69 71 break; 70 72 case protocol_v1: 71 73 /*
+1 -1
builtin/var.c
··· 42 42 43 43 static char *pager(int ident_flag UNUSED) 44 44 { 45 - const char *pgm = git_pager(1); 45 + const char *pgm = git_pager(the_repository, 1); 46 46 47 47 if (!pgm) 48 48 pgm = "cat";
+1 -1
bulk-checkin.c
··· 333 333 if (!odb_transaction_nesting || bulk_fsync_objdir) 334 334 return; 335 335 336 - bulk_fsync_objdir = tmp_objdir_create("bulk-fsync"); 336 + bulk_fsync_objdir = tmp_objdir_create(the_repository, "bulk-fsync"); 337 337 if (bulk_fsync_objdir) 338 338 tmp_objdir_replace_primary_odb(bulk_fsync_objdir, 0); 339 339 }
+17 -3
commit-graph.c
··· 1534 1534 1535 1535 if (ctx->report_progress) 1536 1536 ctx->progress = start_delayed_progress( 1537 + the_repository, 1537 1538 _("Loading known commits in commit graph"), 1538 1539 ctx->oids.nr); 1539 1540 for (i = 0; i < ctx->oids.nr; i++) { ··· 1551 1552 */ 1552 1553 if (ctx->report_progress) 1553 1554 ctx->progress = start_delayed_progress( 1555 + the_repository, 1554 1556 _("Expanding reachable commits in commit graph"), 1555 1557 0); 1556 1558 for (i = 0; i < ctx->oids.nr; i++) { ··· 1571 1573 1572 1574 if (ctx->report_progress) 1573 1575 ctx->progress = start_delayed_progress( 1576 + the_repository, 1574 1577 _("Clearing commit marks in commit graph"), 1575 1578 ctx->oids.nr); 1576 1579 for (i = 0; i < ctx->oids.nr; i++) { ··· 1688 1691 if (ctx->report_progress) 1689 1692 info.progress = ctx->progress 1690 1693 = start_delayed_progress( 1694 + the_repository, 1691 1695 _("Computing commit graph topological levels"), 1692 1696 ctx->commits.nr); 1693 1697 ··· 1722 1726 if (ctx->report_progress) 1723 1727 info.progress = ctx->progress 1724 1728 = start_delayed_progress( 1729 + the_repository, 1725 1730 _("Computing commit graph generation numbers"), 1726 1731 ctx->commits.nr); 1727 1732 ··· 1798 1803 1799 1804 if (ctx->report_progress) 1800 1805 progress = start_delayed_progress( 1806 + the_repository, 1801 1807 _("Computing commit changed paths Bloom filters"), 1802 1808 ctx->commits.nr); 1803 1809 ··· 1877 1883 data.commits = &commits; 1878 1884 if (flags & COMMIT_GRAPH_WRITE_PROGRESS) 1879 1885 data.progress = start_delayed_progress( 1886 + the_repository, 1880 1887 _("Collecting referenced commits"), 0); 1881 1888 1882 1889 refs_for_each_ref(get_main_ref_store(the_repository), add_ref_to_set, ··· 1908 1915 "Finding commits for commit graph in %"PRIuMAX" packs", 1909 1916 pack_indexes->nr), 1910 1917 (uintmax_t)pack_indexes->nr); 1911 - ctx->progress = start_delayed_progress(progress_title.buf, 0); 1918 + ctx->progress = start_delayed_progress(the_repository, 1919 + progress_title.buf, 0); 1912 1920 ctx->progress_done = 0; 1913 1921 } 1914 1922 for (i = 0; i < pack_indexes->nr; i++) { ··· 1959 1967 { 1960 1968 if (ctx->report_progress) 1961 1969 ctx->progress = start_delayed_progress( 1970 + the_repository, 1962 1971 _("Finding commits for commit graph among packed objects"), 1963 1972 ctx->approx_nr_objects); 1964 1973 for_each_packed_object(ctx->r, add_packed_commits, ctx, ··· 1977 1986 ctx->num_extra_edges = 0; 1978 1987 if (ctx->report_progress) 1979 1988 ctx->progress = start_delayed_progress( 1989 + the_repository, 1980 1990 _("Finding extra edges in commit graph"), 1981 1991 ctx->oids.nr); 1982 1992 oid_array_sort(&ctx->oids); ··· 2136 2146 get_num_chunks(cf)), 2137 2147 get_num_chunks(cf)); 2138 2148 ctx->progress = start_delayed_progress( 2149 + the_repository, 2139 2150 progress_title.buf, 2140 2151 st_mult(get_num_chunks(cf), ctx->commits.nr)); 2141 2152 } ··· 2348 2359 2349 2360 if (ctx->report_progress) 2350 2361 ctx->progress = start_delayed_progress( 2362 + the_repository, 2351 2363 _("Scanning merged commits"), 2352 2364 ctx->commits.nr); 2353 2365 ··· 2392 2404 current_graph_number--; 2393 2405 2394 2406 if (ctx->report_progress) 2395 - ctx->progress = start_delayed_progress(_("Merging commit-graph"), 0); 2407 + ctx->progress = start_delayed_progress(the_repository, 2408 + _("Merging commit-graph"), 0); 2396 2409 2397 2410 merge_commit_graph(ctx, g); 2398 2411 stop_progress(&ctx->progress); ··· 2874 2887 if (!(flags & COMMIT_GRAPH_VERIFY_SHALLOW)) 2875 2888 total += g->num_commits_in_base; 2876 2889 2877 - progress = start_progress(_("Verifying commits in commit graph"), 2890 + progress = start_progress(the_repository, 2891 + _("Verifying commits in commit graph"), 2878 2892 total); 2879 2893 } 2880 2894
+17 -17
credential.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 170 169 return matches; 171 170 } 172 171 173 - static void credential_apply_config(struct credential *c) 172 + static void credential_apply_config(struct repository *r, struct credential *c) 174 173 { 175 174 char *normalized_url; 176 175 struct urlmatch_config config = URLMATCH_CONFIG_INIT; ··· 195 194 credential_format(c, &url); 196 195 normalized_url = url_normalize(url.buf, &config.url); 197 196 198 - git_config(urlmatch_config_entry, &config); 197 + repo_config(r, urlmatch_config_entry, &config); 199 198 string_list_clear(&config.vars, 1); 200 199 free(normalized_url); 201 200 urlmatch_config_release(&config); ··· 262 261 return xstrdup(r); 263 262 } 264 263 265 - static int credential_getpass(struct credential *c) 264 + static int credential_getpass(struct repository *r, struct credential *c) 266 265 { 267 266 int interactive; 268 267 char *value; 269 - if (!git_config_get_maybe_bool("credential.interactive", &interactive) && 268 + if (!repo_config_get_maybe_bool(r, "credential.interactive", &interactive) && 270 269 !interactive) { 271 - trace2_data_intmax("credential", the_repository, 270 + trace2_data_intmax("credential", r, 272 271 "interactive/skipped", 1); 273 272 return -1; 274 273 } 275 - if (!git_config_get_string("credential.interactive", &value)) { 274 + if (!repo_config_get_string(r, "credential.interactive", &value)) { 276 275 int same = !strcmp(value, "never"); 277 276 free(value); 278 277 if (same) { 279 - trace2_data_intmax("credential", the_repository, 278 + trace2_data_intmax("credential", r, 280 279 "interactive/skipped", 1); 281 280 return -1; 282 281 } 283 282 } 284 283 285 - trace2_region_enter("credential", "interactive", the_repository); 284 + trace2_region_enter("credential", "interactive", r); 286 285 if (!c->username) 287 286 c->username = credential_ask_one("Username", c, 288 287 PROMPT_ASKPASS|PROMPT_ECHO); 289 288 if (!c->password) 290 289 c->password = credential_ask_one("Password", c, 291 290 PROMPT_ASKPASS); 292 - trace2_region_leave("credential", "interactive", the_repository); 291 + trace2_region_leave("credential", "interactive", r); 293 292 294 293 return 0; 295 294 } ··· 502 501 return r; 503 502 } 504 503 505 - void credential_fill(struct credential *c, int all_capabilities) 504 + void credential_fill(struct repository *r, 505 + struct credential *c, int all_capabilities) 506 506 { 507 507 int i; 508 508 ··· 512 512 credential_next_state(c); 513 513 c->multistage = 0; 514 514 515 - credential_apply_config(c); 515 + credential_apply_config(r, c); 516 516 if (all_capabilities) 517 517 credential_set_all_capabilities(c, CREDENTIAL_OP_INITIAL); 518 518 ··· 539 539 c->helpers.items[i].string); 540 540 } 541 541 542 - if (credential_getpass(c) || 542 + if (credential_getpass(r, c) || 543 543 (!c->username && !c->password && !c->credential)) 544 544 die("unable to get password from user"); 545 545 } 546 546 547 - void credential_approve(struct credential *c) 547 + void credential_approve(struct repository *r, struct credential *c) 548 548 { 549 549 int i; 550 550 ··· 555 555 556 556 credential_next_state(c); 557 557 558 - credential_apply_config(c); 558 + credential_apply_config(r, c); 559 559 560 560 for (i = 0; i < c->helpers.nr; i++) 561 561 credential_do(c, c->helpers.items[i].string, "store"); 562 562 c->approved = 1; 563 563 } 564 564 565 - void credential_reject(struct credential *c) 565 + void credential_reject(struct repository *r, struct credential *c) 566 566 { 567 567 int i; 568 568 569 569 credential_next_state(c); 570 570 571 - credential_apply_config(c); 571 + credential_apply_config(r, c); 572 572 573 573 for (i = 0; i < c->helpers.nr; i++) 574 574 credential_do(c, c->helpers.items[i].string, "erase");
+7 -4
credential.h
··· 4 4 #include "string-list.h" 5 5 #include "strvec.h" 6 6 7 + struct repository; 8 + 7 9 /** 8 10 * The credentials API provides an abstracted way of gathering 9 11 * authentication credentials from the user. ··· 65 67 * // Fill in the username and password fields by contacting 66 68 * // helpers and/or asking the user. The function will die if it 67 69 * // fails. 68 - * credential_fill(&c); 70 + * credential_fill(repo, &c); 69 71 * 70 72 * // Otherwise, we have a username and password. Try to use it. 71 73 * ··· 222 224 * If all_capabilities is set, this is an internal user that is prepared 223 225 * to deal with all known capabilities, and we should advertise that fact. 224 226 */ 225 - void credential_fill(struct credential *, int all_capabilities); 227 + void credential_fill(struct repository *, struct credential *, 228 + int all_capabilities); 226 229 227 230 /** 228 231 * Inform the credential subsystem that the provided credentials ··· 231 234 * that they may store the result to be used again. Any errors 232 235 * from helpers are ignored. 233 236 */ 234 - void credential_approve(struct credential *); 237 + void credential_approve(struct repository *, struct credential *); 235 238 236 239 /** 237 240 * Inform the credential subsystem that the provided credentials ··· 243 246 * for another call to `credential_fill`). Any errors from helpers 244 247 * are ignored. 245 248 */ 246 - void credential_reject(struct credential *); 249 + void credential_reject(struct repository *, struct credential *); 247 250 248 251 /** 249 252 * Enable all of the supported credential flags in this credential.
+2 -1
delta-islands.c
··· 267 267 QSORT(todo, nr, tree_depth_compare); 268 268 269 269 if (progress) 270 - progress_state = start_progress(_("Propagating island marks"), nr); 270 + progress_state = start_progress(the_repository, 271 + _("Propagating island marks"), nr); 271 272 272 273 for (i = 0; i < nr; i++) { 273 274 struct object_entry *ent = todo[i].entry;
+8 -7
diagnose.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 - 3 1 #include "git-compat-util.h" 4 2 #include "diagnose.h" 5 3 #include "compat/disk.h" ··· 12 10 #include "object-store-ll.h" 13 11 #include "packfile.h" 14 12 #include "parse-options.h" 13 + #include "repository.h" 15 14 #include "write-or-die.h" 16 15 17 16 struct archive_dir { ··· 179 178 return res; 180 179 } 181 180 182 - int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode) 181 + int create_diagnostics_archive(struct repository *r, 182 + struct strbuf *zip_path, 183 + enum diagnose_mode mode) 183 184 { 184 185 struct strvec archiver_args = STRVEC_INIT; 185 186 char **argv_copy = NULL; ··· 218 219 strbuf_addstr(&buf, "Collecting diagnostic info\n\n"); 219 220 get_version_info(&buf, 1); 220 221 221 - strbuf_addf(&buf, "Repository root: %s\n", the_repository->worktree); 222 + strbuf_addf(&buf, "Repository root: %s\n", r->worktree); 222 223 get_disk_info(&buf); 223 224 write_or_die(stdout_fd, buf.buf, buf.len); 224 225 strvec_pushf(&archiver_args, ··· 227 228 228 229 strbuf_reset(&buf); 229 230 strbuf_addstr(&buf, "--add-virtual-file=packs-local.txt:"); 230 - dir_file_stats(the_repository->objects->odb, &buf); 231 + dir_file_stats(r->objects->odb, &buf); 231 232 foreach_alt_odb(dir_file_stats, &buf); 232 233 strvec_push(&archiver_args, buf.buf); 233 234 ··· 250 251 } 251 252 252 253 strvec_pushl(&archiver_args, "--prefix=", 253 - oid_to_hex(the_hash_algo->empty_tree), "--", NULL); 254 + oid_to_hex(r->hash_algo->empty_tree), "--", NULL); 254 255 255 256 /* `write_archive()` modifies the `argv` passed to it. Let it. */ 256 257 argv_copy = xmemdupz(archiver_args.v, 257 258 sizeof(char *) * archiver_args.nr); 258 259 res = write_archive(archiver_args.nr, (const char **)argv_copy, NULL, 259 - the_repository, NULL, 0); 260 + r, NULL, 0); 260 261 if (res) { 261 262 error(_("failed to write archive")); 262 263 goto diagnose_cleanup;
+4 -1
diagnose.h
··· 4 4 #include "strbuf.h" 5 5 6 6 struct option; 7 + struct repository; 7 8 8 9 enum diagnose_mode { 9 10 DIAGNOSE_NONE, ··· 13 14 14 15 int option_parse_diagnose(const struct option *opt, const char *arg, int unset); 15 16 16 - int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode); 17 + int create_diagnostics_archive(struct repository *r, 18 + struct strbuf *zip_path, 19 + enum diagnose_mode mode); 17 20 18 21 #endif /* DIAGNOSE_H */
+2 -2
diff.c
··· 7386 7386 * --exit-code" in hooks and other scripts, we do not do so. 7387 7387 */ 7388 7388 if (!opt->flags.exit_with_status && 7389 - check_pager_config("diff") != 0) 7390 - setup_pager(); 7389 + check_pager_config(the_repository, "diff") != 0) 7390 + setup_pager(the_repository); 7391 7391 }
+1
diffcore-rename.c
··· 1567 1567 trace2_region_enter("diff", "inexact renames", options->repo); 1568 1568 if (options->show_rename_progress) { 1569 1569 progress = start_delayed_progress( 1570 + the_repository, 1570 1571 _("Performing inexact rename detection"), 1571 1572 (uint64_t)num_destinations * (uint64_t)num_sources); 1572 1573 }
+3 -1
entry.c
··· 188 188 189 189 dco->state = CE_RETRY; 190 190 if (show_progress) 191 - progress = start_delayed_progress(_("Filtering content"), dco->paths.nr); 191 + progress = start_delayed_progress(the_repository, 192 + _("Filtering content"), 193 + dco->paths.nr); 192 194 while (dco->filters.nr > 0) { 193 195 for_each_string_list_item(filter, &dco->filters) { 194 196 struct string_list available_paths = STRING_LIST_INIT_DUP;
+5 -5
git.c
··· 125 125 setenv("GIT_PAGER", "cat", 1); 126 126 break; 127 127 case 1: 128 - setup_pager(); 128 + setup_pager(the_repository); 129 129 break; 130 130 default: 131 131 break; ··· 136 136 { 137 137 if (use_pager != -1 || pager_in_use()) 138 138 return; 139 - use_pager = check_pager_config(cmd); 139 + use_pager = check_pager_config(the_repository, cmd); 140 140 if (use_pager == -1) 141 141 use_pager = def; 142 142 commit_pager_choice(); ··· 462 462 precompose_argv_prefix(argc, argv, NULL); 463 463 if (use_pager == -1 && run_setup && 464 464 !(p->option & DELAY_PAGER_CONFIG)) 465 - use_pager = check_pager_config(p->cmd); 465 + use_pager = check_pager_config(the_repository, p->cmd); 466 466 if (use_pager == -1 && p->option & USE_PAGER) 467 467 use_pager = 1; 468 468 if (run_setup && startup_info->have_repository) 469 469 /* get_git_dir() may set up repo, avoid that */ 470 - trace_repo_setup(); 470 + trace_repo_setup(the_repository); 471 471 commit_pager_choice(); 472 472 473 473 if (!help && p->option & NEED_WORK_TREE) ··· 750 750 int status; 751 751 752 752 if (use_pager == -1 && !is_builtin(argv[0])) 753 - use_pager = check_pager_config(argv[0]); 753 + use_pager = check_pager_config(the_repository, argv[0]); 754 754 commit_pager_choice(); 755 755 756 756 strvec_pushf(&cmd.args, "git-%s", argv[0]);
+1 -2
graph.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 351 350 352 351 if (!column_colors) { 353 352 char *string; 354 - if (git_config_get_string("log.graphcolors", &string)) { 353 + if (repo_config_get_string(opt->repo, "log.graphcolors", &string)) { 355 354 /* not configured -- use default */ 356 355 graph_set_column_colors(column_colors_ansi, 357 356 column_colors_ansi_max);
+12 -12
http.c
··· 609 609 } 610 610 } 611 611 612 - credential_fill(&http_auth, 1); 612 + credential_fill(the_repository, &http_auth, 1); 613 613 614 614 if (http_auth.password) { 615 615 if (always_auth_proactively()) { ··· 652 652 { 653 653 if (proxy_auth.username) { 654 654 if (!proxy_auth.password && !proxy_auth.credential) 655 - credential_fill(&proxy_auth, 1); 655 + credential_fill(the_repository, &proxy_auth, 1); 656 656 set_proxyauth_name_password(result); 657 657 } 658 658 ··· 686 686 cert_auth.host = xstrdup(""); 687 687 cert_auth.username = xstrdup(""); 688 688 cert_auth.path = xstrdup(ssl_cert); 689 - credential_fill(&cert_auth, 0); 689 + credential_fill(the_repository, &cert_auth, 0); 690 690 } 691 691 return 1; 692 692 } ··· 700 700 proxy_cert_auth.host = xstrdup(""); 701 701 proxy_cert_auth.username = xstrdup(""); 702 702 proxy_cert_auth.path = xstrdup(http_proxy_ssl_cert); 703 - credential_fill(&proxy_cert_auth, 0); 703 + credential_fill(the_repository, &proxy_cert_auth, 0); 704 704 } 705 705 return 1; 706 706 } ··· 1784 1784 curl_errorstr, sizeof(curl_errorstr)); 1785 1785 1786 1786 if (results->curl_result == CURLE_OK) { 1787 - credential_approve(&http_auth); 1788 - credential_approve(&proxy_auth); 1789 - credential_approve(&cert_auth); 1787 + credential_approve(the_repository, &http_auth); 1788 + credential_approve(the_repository, &proxy_auth); 1789 + credential_approve(the_repository, &cert_auth); 1790 1790 return HTTP_OK; 1791 1791 } else if (results->curl_result == CURLE_SSL_CERTPROBLEM) { 1792 1792 /* ··· 1795 1795 * with the certificate. So we reject the credential to 1796 1796 * avoid caching or saving a bad password. 1797 1797 */ 1798 - credential_reject(&cert_auth); 1798 + credential_reject(the_repository, &cert_auth); 1799 1799 return HTTP_NOAUTH; 1800 1800 } else if (results->curl_result == CURLE_SSL_PINNEDPUBKEYNOTMATCH) { 1801 1801 return HTTP_NOMATCHPUBLICKEY; ··· 1808 1808 credential_clear_secrets(&http_auth); 1809 1809 return HTTP_REAUTH; 1810 1810 } 1811 - credential_reject(&http_auth); 1811 + credential_reject(the_repository, &http_auth); 1812 1812 if (always_auth_proactively()) 1813 1813 http_proactive_auth = PROACTIVE_AUTH_NONE; 1814 1814 return HTTP_NOAUTH; ··· 1822 1822 } 1823 1823 } else { 1824 1824 if (results->http_connectcode == 407) 1825 - credential_reject(&proxy_auth); 1825 + credential_reject(the_repository, &proxy_auth); 1826 1826 if (!curl_errorstr[0]) 1827 1827 strlcpy(curl_errorstr, 1828 1828 curl_easy_strerror(results->curl_result), ··· 2210 2210 int ret; 2211 2211 2212 2212 if (always_auth_proactively()) 2213 - credential_fill(&http_auth, 1); 2213 + credential_fill(the_repository, &http_auth, 1); 2214 2214 2215 2215 ret = http_request(url, result, target, options); 2216 2216 ··· 2251 2251 BUG("Unknown http_request target"); 2252 2252 } 2253 2253 2254 - credential_fill(&http_auth, 1); 2254 + credential_fill(the_repository, &http_auth, 1); 2255 2255 2256 2256 ret = http_request(url, result, target, options); 2257 2257 }
+5 -5
imap-send.c
··· 922 922 cred->username = xstrdup_or_null(srvc->user); 923 923 cred->password = xstrdup_or_null(srvc->pass); 924 924 925 - credential_fill(cred, 1); 925 + credential_fill(the_repository, cred, 1); 926 926 927 927 if (!srvc->user) 928 928 srvc->user = xstrdup(cred->username); ··· 1123 1123 } /* !preauth */ 1124 1124 1125 1125 if (cred.username) 1126 - credential_approve(&cred); 1126 + credential_approve(the_repository, &cred); 1127 1127 credential_clear(&cred); 1128 1128 1129 1129 /* check the target mailbox exists */ ··· 1150 1150 1151 1151 bail: 1152 1152 if (cred.username) 1153 - credential_reject(&cred); 1153 + credential_reject(the_repository, &cred); 1154 1154 credential_clear(&cred); 1155 1155 1156 1156 out: ··· 1492 1492 1493 1493 if (cred.username) { 1494 1494 if (res == CURLE_OK) 1495 - credential_approve(&cred); 1495 + credential_approve(the_repository, &cred); 1496 1496 else if (res == CURLE_LOGIN_DENIED) 1497 - credential_reject(&cred); 1497 + credential_reject(the_repository, &cred); 1498 1498 } 1499 1499 1500 1500 credential_clear(&cred);
+1 -1
log-tree.c
··· 1042 1042 * into the alternative object store list as the primary. 1043 1043 */ 1044 1044 if (opt->remerge_diff && !opt->remerge_objdir) { 1045 - opt->remerge_objdir = tmp_objdir_create("remerge-diff"); 1045 + opt->remerge_objdir = tmp_objdir_create(the_repository, "remerge-diff"); 1046 1046 if (!opt->remerge_objdir) 1047 1047 return error(_("unable to create temporary object directory")); 1048 1048 tmp_objdir_replace_primary_odb(opt->remerge_objdir, 1);
+2 -3
mailinfo.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 1269 1268 return 0; 1270 1269 } 1271 1270 1272 - void setup_mailinfo(struct mailinfo *mi) 1271 + void setup_mailinfo(struct repository *r, struct mailinfo *mi) 1273 1272 { 1274 1273 memset(mi, 0, sizeof(*mi)); 1275 1274 strbuf_init(&mi->name, 0); ··· 1281 1280 mi->header_stage = 1; 1282 1281 mi->use_inbody_headers = 1; 1283 1282 mi->content_top = mi->content; 1284 - git_config(git_mailinfo_config, mi); 1283 + repo_config(r, git_mailinfo_config, mi); 1285 1284 } 1286 1285 1287 1286 void clear_mailinfo(struct mailinfo *mi)
+3 -1
mailinfo.h
··· 5 5 6 6 #define MAX_BOUNDARIES 5 7 7 8 + struct repository; 9 + 8 10 enum quoted_cr_action { 9 11 quoted_cr_unset = -1, 10 12 quoted_cr_nowarn, ··· 49 51 }; 50 52 51 53 int mailinfo_parse_quoted_cr_action(const char *actionstr, int *action); 52 - void setup_mailinfo(struct mailinfo *); 54 + void setup_mailinfo(struct repository *r, struct mailinfo *); 53 55 int mailinfo(struct mailinfo *, const char *msg, const char *patch); 54 56 void clear_mailinfo(struct mailinfo *); 55 57
+27 -23
match-trees.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 8 7 #include "tree.h" 9 8 #include "tree-walk.h" 10 9 #include "object-store-ll.h" 10 + #include "repository.h" 11 11 12 12 static int score_missing(unsigned mode) 13 13 { ··· 54 54 return score; 55 55 } 56 56 57 - static void *fill_tree_desc_strict(struct tree_desc *desc, 57 + static void *fill_tree_desc_strict(struct repository *r, 58 + struct tree_desc *desc, 58 59 const struct object_id *hash) 59 60 { 60 61 void *buffer; 61 62 enum object_type type; 62 63 unsigned long size; 63 64 64 - buffer = repo_read_object_file(the_repository, hash, &type, &size); 65 + buffer = repo_read_object_file(r, hash, &type, &size); 65 66 if (!buffer) 66 67 die("unable to read tree (%s)", oid_to_hex(hash)); 67 68 if (type != OBJ_TREE) ··· 80 81 /* 81 82 * Inspect two trees, and give a score that tells how similar they are. 82 83 */ 83 - static int score_trees(const struct object_id *hash1, const struct object_id *hash2) 84 + static int score_trees(struct repository *r, 85 + const struct object_id *hash1, const struct object_id *hash2) 84 86 { 85 87 struct tree_desc one; 86 88 struct tree_desc two; 87 - void *one_buf = fill_tree_desc_strict(&one, hash1); 88 - void *two_buf = fill_tree_desc_strict(&two, hash2); 89 + void *one_buf = fill_tree_desc_strict(r, &one, hash1); 90 + void *two_buf = fill_tree_desc_strict(r, &two, hash2); 89 91 int score = 0; 90 92 91 93 for (;;) { ··· 133 135 /* 134 136 * Match one itself and its subtrees with two and pick the best match. 135 137 */ 136 - static void match_trees(const struct object_id *hash1, 138 + static void match_trees(struct repository *r, 139 + const struct object_id *hash1, 137 140 const struct object_id *hash2, 138 141 int *best_score, 139 142 char **best_match, ··· 141 144 int recurse_limit) 142 145 { 143 146 struct tree_desc one; 144 - void *one_buf = fill_tree_desc_strict(&one, hash1); 147 + void *one_buf = fill_tree_desc_strict(r, &one, hash1); 145 148 146 149 while (one.size) { 147 150 const char *path; ··· 152 155 elem = tree_entry_extract(&one, &path, &mode); 153 156 if (!S_ISDIR(mode)) 154 157 goto next; 155 - score = score_trees(elem, hash2); 158 + score = score_trees(r, elem, hash2); 156 159 if (*best_score < score) { 157 160 free(*best_match); 158 161 *best_match = xstrfmt("%s%s", base, path); ··· 160 163 } 161 164 if (recurse_limit) { 162 165 char *newbase = xstrfmt("%s%s/", base, path); 163 - match_trees(elem, hash2, best_score, best_match, 166 + match_trees(r, elem, hash2, best_score, best_match, 164 167 newbase, recurse_limit - 1); 165 168 free(newbase); 166 169 } ··· 175 178 * A tree "oid1" has a subdirectory at "prefix". Come up with a tree object by 176 179 * replacing it with another tree "oid2". 177 180 */ 178 - static int splice_tree(const struct object_id *oid1, const char *prefix, 181 + static int splice_tree(struct repository *r, 182 + const struct object_id *oid1, const char *prefix, 179 183 const struct object_id *oid2, struct object_id *result) 180 184 { 181 185 char *subpath; ··· 194 198 if (*subpath) 195 199 subpath++; 196 200 197 - buf = repo_read_object_file(the_repository, oid1, &type, &sz); 201 + buf = repo_read_object_file(r, oid1, &type, &sz); 198 202 if (!buf) 199 203 die("cannot read tree %s", oid_to_hex(oid1)); 200 204 init_tree_desc(&desc, oid1, buf, sz); ··· 232 236 oid_to_hex(oid1)); 233 237 if (*subpath) { 234 238 struct object_id tree_oid; 235 - oidread(&tree_oid, rewrite_here, the_repository->hash_algo); 236 - status = splice_tree(&tree_oid, subpath, oid2, &subtree); 239 + oidread(&tree_oid, rewrite_here, r->hash_algo); 240 + status = splice_tree(r, &tree_oid, subpath, oid2, &subtree); 237 241 if (status) 238 242 return status; 239 243 rewrite_with = &subtree; 240 244 } else { 241 245 rewrite_with = oid2; 242 246 } 243 - hashcpy(rewrite_here, rewrite_with->hash, the_repository->hash_algo); 247 + hashcpy(rewrite_here, rewrite_with->hash, r->hash_algo); 244 248 status = write_object_file(buf, sz, OBJ_TREE, result); 245 249 free(buf); 246 250 return status; ··· 271 275 if (!depth_limit) 272 276 depth_limit = 2; 273 277 274 - add_score = del_score = score_trees(hash1, hash2); 278 + add_score = del_score = score_trees(r, hash1, hash2); 275 279 add_prefix = xcalloc(1, 1); 276 280 del_prefix = xcalloc(1, 1); 277 281 ··· 279 283 * See if one's subtree resembles two; if so we need to prefix 280 284 * two with a few fake trees to match the prefix. 281 285 */ 282 - match_trees(hash1, hash2, &add_score, &add_prefix, "", depth_limit); 286 + match_trees(r, hash1, hash2, &add_score, &add_prefix, "", depth_limit); 283 287 284 288 /* 285 289 * See if two's subtree resembles one; if so we need to 286 290 * pick only subtree of two. 287 291 */ 288 - match_trees(hash2, hash1, &del_score, &del_prefix, "", depth_limit); 292 + match_trees(r, hash2, hash1, &del_score, &del_prefix, "", depth_limit); 289 293 290 294 /* Assume we do not have to do any shifting */ 291 295 oidcpy(shifted, hash2); ··· 306 310 if (!*add_prefix) 307 311 goto out; 308 312 309 - splice_tree(hash1, add_prefix, hash2, shifted); 313 + splice_tree(r, hash1, add_prefix, hash2, shifted); 310 314 311 315 out: 312 316 free(add_prefix); ··· 340 344 341 345 if (candidate == 3) { 342 346 /* Both are plausible -- we need to evaluate the score */ 343 - int best_score = score_trees(hash1, hash2); 347 + int best_score = score_trees(r, hash1, hash2); 344 348 int score; 345 349 346 350 candidate = 0; 347 - score = score_trees(&sub1, hash2); 351 + score = score_trees(r, &sub1, hash2); 348 352 if (score > best_score) { 349 353 candidate = 1; 350 354 best_score = score; 351 355 } 352 - score = score_trees(&sub2, hash1); 356 + score = score_trees(r, &sub2, hash1); 353 357 if (score > best_score) 354 358 candidate = 2; 355 359 } ··· 365 369 * shift tree2 down by adding shift_prefix above it 366 370 * to match tree1. 367 371 */ 368 - splice_tree(hash1, shift_prefix, hash2, shifted); 372 + splice_tree(r, hash1, shift_prefix, hash2, shifted); 369 373 else 370 374 /* 371 375 * shift tree2 up by removing shift_prefix from it
+8 -3
midx-write.c
··· 1131 1131 1132 1132 ctx.pack_paths_checked = 0; 1133 1133 if (flags & MIDX_PROGRESS) 1134 - ctx.progress = start_delayed_progress(_("Adding packfiles to multi-pack-index"), 0); 1134 + ctx.progress = start_delayed_progress(r, 1135 + _("Adding packfiles to multi-pack-index"), 0); 1135 1136 else 1136 1137 ctx.progress = NULL; 1137 1138 ··· 1539 1540 CALLOC_ARRAY(count, m->num_packs); 1540 1541 1541 1542 if (flags & MIDX_PROGRESS) 1542 - progress = start_delayed_progress(_("Counting referenced objects"), 1543 + progress = start_delayed_progress( 1544 + r, 1545 + _("Counting referenced objects"), 1543 1546 m->num_objects); 1544 1547 for (i = 0; i < m->num_objects; i++) { 1545 1548 int pack_int_id = nth_midxed_pack_int_id(m, i); ··· 1549 1552 stop_progress(&progress); 1550 1553 1551 1554 if (flags & MIDX_PROGRESS) 1552 - progress = start_delayed_progress(_("Finding and deleting unreferenced packfiles"), 1555 + progress = start_delayed_progress( 1556 + r, 1557 + _("Finding and deleting unreferenced packfiles"), 1553 1558 m->num_packs); 1554 1559 for (i = 0; i < m->num_packs; i++) { 1555 1560 char *pack_name;
+9 -4
midx.c
··· 907 907 midx_report(_("incorrect checksum")); 908 908 909 909 if (flags & MIDX_PROGRESS) 910 - progress = start_delayed_progress(_("Looking for referenced packfiles"), 910 + progress = start_delayed_progress(r, 911 + _("Looking for referenced packfiles"), 911 912 m->num_packs + m->num_packs_in_base); 912 913 for (i = 0; i < m->num_packs + m->num_packs_in_base; i++) { 913 914 if (prepare_midx_pack(r, m, i)) ··· 927 928 } 928 929 929 930 if (flags & MIDX_PROGRESS) 930 - progress = start_sparse_progress(_("Verifying OID order in multi-pack-index"), 931 + progress = start_sparse_progress(r, 932 + _("Verifying OID order in multi-pack-index"), 931 933 m->num_objects - 1); 932 934 933 935 for (curr = m; curr; curr = curr->base_midx) { ··· 959 961 } 960 962 961 963 if (flags & MIDX_PROGRESS) 962 - progress = start_sparse_progress(_("Sorting objects by packfile"), 964 + progress = start_sparse_progress(r, 965 + _("Sorting objects by packfile"), 963 966 m->num_objects); 964 967 display_progress(progress, 0); /* TODO: Measure QSORT() progress */ 965 968 QSORT(pairs, m->num_objects, compare_pair_pos_vs_id); 966 969 stop_progress(&progress); 967 970 968 971 if (flags & MIDX_PROGRESS) 969 - progress = start_sparse_progress(_("Verifying object offsets"), m->num_objects); 972 + progress = start_sparse_progress(r, 973 + _("Verifying object offsets"), 974 + m->num_objects); 970 975 for (i = 0; i < m->num_objects + m->num_objects_in_base; i++) { 971 976 struct object_id oid; 972 977 struct pack_entry e;
+1 -1
oss-fuzz/fuzz-parse-attr-line.c
··· 24 24 res = parse_attr_line(buf, "dummy", 0, 0); 25 25 26 26 if (res) { 27 - int j; 27 + size_t j; 28 28 for (j = 0; j < res->num_attr; j++) { 29 29 const char *setto = res->state[j].setto; 30 30 if (ATTR_TRUE(setto) || ATTR_FALSE(setto) ||
+4 -2
pack-bitmap-write.c
··· 590 590 int closed = 1; /* until proven otherwise */ 591 591 592 592 if (writer->show_progress) 593 - writer->progress = start_progress("Building bitmaps", 593 + writer->progress = start_progress(the_repository, 594 + "Building bitmaps", 594 595 writer->selected_nr); 595 596 trace2_region_enter("pack-bitmap-write", "building_bitmaps_total", 596 597 the_repository); ··· 710 711 } 711 712 712 713 if (writer->show_progress) 713 - writer->progress = start_progress("Selecting bitmap commits", 0); 714 + writer->progress = start_progress(the_repository, 715 + "Selecting bitmap commits", 0); 714 716 715 717 for (;;) { 716 718 struct commit *chosen = NULL;
+3 -1
pack-bitmap.c
··· 2573 2573 tdata.trees = ewah_to_bitmap(bitmap_git->trees); 2574 2574 tdata.blobs = ewah_to_bitmap(bitmap_git->blobs); 2575 2575 tdata.tags = ewah_to_bitmap(bitmap_git->tags); 2576 - tdata.prg = start_progress("Verifying bitmap entries", result_popcnt); 2576 + tdata.prg = start_progress(revs->repo, 2577 + "Verifying bitmap entries", 2578 + result_popcnt); 2577 2579 tdata.seen = 0; 2578 2580 2579 2581 traverse_commit_list(revs, &test_show_commit, &test_show_object, &tdata);
+6 -8
pager.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 - 3 1 #include "git-compat-util.h" 4 2 #include "config.h" 5 3 #include "editor.h" ··· 84 82 return 0; 85 83 } 86 84 87 - const char *git_pager(int stdout_is_tty) 85 + const char *git_pager(struct repository *r, int stdout_is_tty) 88 86 { 89 87 const char *pager; 90 88 ··· 94 92 pager = getenv("GIT_PAGER"); 95 93 if (!pager) { 96 94 if (!pager_program) 97 - read_early_config(the_repository, 95 + read_early_config(r, 98 96 core_pager_config, NULL); 99 97 pager = pager_program; 100 98 } ··· 143 141 pager_process->trace2_child_class = "pager"; 144 142 } 145 143 146 - void setup_pager(void) 144 + void setup_pager(struct repository *r) 147 145 { 148 146 static int once = 0; 149 - const char *pager = git_pager(isatty(1)); 147 + const char *pager = git_pager(r, isatty(1)); 150 148 151 149 if (!pager) 152 150 return; ··· 293 291 } 294 292 295 293 /* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */ 296 - int check_pager_config(const char *cmd) 294 + int check_pager_config(struct repository *r, const char *cmd) 297 295 { 298 296 struct pager_command_config_data data; 299 297 ··· 301 299 data.want = -1; 302 300 data.value = NULL; 303 301 304 - read_early_config(the_repository, pager_command_config, &data); 302 + read_early_config(r, pager_command_config, &data); 305 303 306 304 if (data.value) 307 305 pager_program = data.value;
+4 -3
pager.h
··· 2 2 #define PAGER_H 3 3 4 4 struct child_process; 5 + struct repository; 5 6 6 - const char *git_pager(int stdout_is_tty); 7 - void setup_pager(void); 7 + const char *git_pager(struct repository *r, int stdout_is_tty); 8 + void setup_pager(struct repository *r); 8 9 void wait_for_pager(void); 9 10 int pager_in_use(void); 10 11 int term_columns(void); 11 12 void term_clear_line(void); 12 13 int decimal_width(uintmax_t); 13 - int check_pager_config(const char *cmd); 14 + int check_pager_config(struct repository *r, const char *cmd); 14 15 void prepare_pager_args(struct child_process *, const char *pager); 15 16 16 17 extern int pager_use_color;
+3 -1
preload-index.c
··· 132 132 133 133 memset(&pd, 0, sizeof(pd)); 134 134 if (refresh_flags & REFRESH_PROGRESS && isatty(2)) { 135 - pd.progress = start_delayed_progress(_("Refreshing index"), index->cache_nr); 135 + pd.progress = start_delayed_progress(the_repository, 136 + _("Refreshing index"), 137 + index->cache_nr); 136 138 pthread_mutex_init(&pd.mutex, NULL); 137 139 } 138 140
+20 -14
progress.c
··· 9 9 */ 10 10 11 11 #define GIT_TEST_PROGRESS_ONLY 12 - #define USE_THE_REPOSITORY_VARIABLE 13 12 #define DISABLE_SIGN_COMPARE_WARNINGS 14 13 15 14 #include "git-compat-util.h" ··· 37 36 }; 38 37 39 38 struct progress { 39 + struct repository *repo; 40 40 const char *title; 41 41 uint64_t last_value; 42 42 uint64_t total; ··· 254 254 display(progress, n, NULL); 255 255 } 256 256 257 - static struct progress *start_progress_delay(const char *title, uint64_t total, 257 + static struct progress *start_progress_delay(struct repository *r, 258 + const char *title, uint64_t total, 258 259 unsigned delay, unsigned sparse) 259 260 { 260 261 struct progress *progress = xmalloc(sizeof(*progress)); 262 + progress->repo = r; 261 263 progress->title = title; 262 264 progress->total = total; 263 265 progress->last_value = -1; ··· 270 272 progress->title_len = utf8_strwidth(title); 271 273 progress->split = 0; 272 274 set_progress_signal(); 273 - trace2_region_enter("progress", title, the_repository); 275 + trace2_region_enter("progress", title, r); 274 276 return progress; 275 277 } 276 278 ··· 284 286 return delay_in_secs; 285 287 } 286 288 287 - struct progress *start_delayed_progress(const char *title, uint64_t total) 289 + struct progress *start_delayed_progress(struct repository *r, 290 + const char *title, uint64_t total) 288 291 { 289 - return start_progress_delay(title, total, get_default_delay(), 0); 292 + return start_progress_delay(r, title, total, get_default_delay(), 0); 290 293 } 291 294 292 - struct progress *start_progress(const char *title, uint64_t total) 295 + struct progress *start_progress(struct repository *r, 296 + const char *title, uint64_t total) 293 297 { 294 - return start_progress_delay(title, total, 0, 0); 298 + return start_progress_delay(r, title, total, 0, 0); 295 299 } 296 300 297 301 /* ··· 303 307 * When "sparse" is set, stop_progress() will automatically force the done 304 308 * message to show 100%. 305 309 */ 306 - struct progress *start_sparse_progress(const char *title, uint64_t total) 310 + struct progress *start_sparse_progress(struct repository *r, 311 + const char *title, uint64_t total) 307 312 { 308 - return start_progress_delay(title, total, 0, 1); 313 + return start_progress_delay(r, title, total, 0, 1); 309 314 } 310 315 311 - struct progress *start_delayed_sparse_progress(const char *title, 316 + struct progress *start_delayed_sparse_progress(struct repository *r, 317 + const char *title, 312 318 uint64_t total) 313 319 { 314 - return start_progress_delay(title, total, get_default_delay(), 1); 320 + return start_progress_delay(r, title, total, get_default_delay(), 1); 315 321 } 316 322 317 323 static void finish_if_sparse(struct progress *progress) ··· 341 347 342 348 static void log_trace2(struct progress *progress) 343 349 { 344 - trace2_data_intmax("progress", the_repository, "total_objects", 350 + trace2_data_intmax("progress", progress->repo, "total_objects", 345 351 progress->total); 346 352 347 353 if (progress->throughput) 348 - trace2_data_intmax("progress", the_repository, "total_bytes", 354 + trace2_data_intmax("progress", progress->repo, "total_bytes", 349 355 progress->throughput->curr_total); 350 356 351 - trace2_region_leave("progress", progress->title, the_repository); 357 + trace2_region_leave("progress", progress->title, progress->repo); 352 358 } 353 359 354 360 void stop_progress_msg(struct progress **p_progress, const char *msg)
+9 -4
progress.h
··· 3 3 #include "gettext.h" 4 4 5 5 struct progress; 6 + struct repository; 6 7 7 8 #ifdef GIT_TEST_PROGRESS_ONLY 8 9 ··· 14 15 15 16 void display_throughput(struct progress *progress, uint64_t total); 16 17 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, 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, 21 26 uint64_t total); 22 27 void stop_progress_msg(struct progress **p_progress, const char *msg); 23 28 static inline void stop_progress(struct progress **p_progress)
+2 -1
prune-packed.c
··· 37 37 void prune_packed_objects(int opts) 38 38 { 39 39 if (opts & PRUNE_PACKED_VERBOSE) 40 - progress = start_delayed_progress(_("Removing duplicate objects"), 256); 40 + progress = start_delayed_progress(the_repository, 41 + _("Removing duplicate objects"), 256); 41 42 42 43 for_each_loose_file_in_objdir(repo_get_object_directory(the_repository), 43 44 prune_object, NULL, prune_subdir, &opts);
+2 -1
pseudo-merge.c
··· 459 459 return; 460 460 461 461 if (writer->show_progress) 462 - progress = start_progress("Selecting pseudo-merge commits", 462 + progress = start_progress(the_repository, 463 + "Selecting pseudo-merge commits", 463 464 writer->pseudo_merge_groups.nr); 464 465 465 466 refs_for_each_ref(get_main_ref_store(the_repository),
+4 -3
read-cache.c
··· 1523 1523 int t2_sum_scan = 0; 1524 1524 1525 1525 if (flags & REFRESH_PROGRESS && isatty(2)) 1526 - progress = start_delayed_progress(_("Refresh index"), 1526 + progress = start_delayed_progress(the_repository, 1527 + _("Refresh index"), 1527 1528 istate->cache_nr); 1528 1529 1529 1530 trace_performance_enter(); ··· 1753 1754 istate->cache_tree = cache_tree_read(data, sz); 1754 1755 break; 1755 1756 case CACHE_EXT_RESOLVE_UNDO: 1756 - istate->resolve_undo = resolve_undo_read(data, sz); 1757 + istate->resolve_undo = resolve_undo_read(data, sz, the_hash_algo); 1757 1758 break; 1758 1759 case CACHE_EXT_LINK: 1759 1760 if (read_link_extension(istate, data, sz)) ··· 3032 3033 istate->resolve_undo) { 3033 3034 strbuf_reset(&sb); 3034 3035 3035 - resolve_undo_write(&sb, istate->resolve_undo); 3036 + resolve_undo_write(&sb, istate->resolve_undo, the_hash_algo); 3036 3037 err = write_index_ext_header(f, eoie_c, CACHE_EXT_RESOLVE_UNDO, 3037 3038 sb.len) < 0; 3038 3039 hashwrite(f, sb.buf, sb.len);
+2 -2
remote-curl.c
··· 942 942 do { 943 943 err = probe_rpc(rpc, &results); 944 944 if (err == HTTP_REAUTH) 945 - credential_fill(&http_auth, 0); 945 + credential_fill(the_repository, &http_auth, 0); 946 946 } while (err == HTTP_REAUTH); 947 947 if (err != HTTP_OK) 948 948 return -1; ··· 1064 1064 rpc->any_written = 0; 1065 1065 err = run_slot(slot, NULL); 1066 1066 if (err == HTTP_REAUTH && !large_request) { 1067 - credential_fill(&http_auth, 0); 1067 + credential_fill(the_repository, &http_auth, 0); 1068 1068 curl_slist_free_all(headers); 1069 1069 goto retry; 1070 1070 }
+7 -7
resolve-undo.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 34 33 ui->mode[stage - 1] = ce->ce_mode; 35 34 } 36 35 37 - void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo) 36 + void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo, 37 + const struct git_hash_algo *algop) 38 38 { 39 39 struct string_list_item *item; 40 40 for_each_string_list_item(item, resolve_undo) { ··· 50 50 for (i = 0; i < 3; i++) { 51 51 if (!ui->mode[i]) 52 52 continue; 53 - strbuf_add(sb, ui->oid[i].hash, the_hash_algo->rawsz); 53 + strbuf_add(sb, ui->oid[i].hash, algop->rawsz); 54 54 } 55 55 } 56 56 } 57 57 58 - struct string_list *resolve_undo_read(const char *data, unsigned long size) 58 + struct string_list *resolve_undo_read(const char *data, unsigned long size, 59 + const struct git_hash_algo *algop) 59 60 { 60 61 struct string_list *resolve_undo; 61 62 size_t len; 62 63 char *endptr; 63 64 int i; 64 - const unsigned rawsz = the_hash_algo->rawsz; 65 + const unsigned rawsz = algop->rawsz; 65 66 66 67 CALLOC_ARRAY(resolve_undo, 1); 67 68 resolve_undo->strdup_strings = 1; ··· 96 97 continue; 97 98 if (size < rawsz) 98 99 goto error; 99 - oidread(&ui->oid[i], (const unsigned char *)data, 100 - the_repository->hash_algo); 100 + oidread(&ui->oid[i], (const unsigned char *)data, algop); 101 101 size -= rawsz; 102 102 data += rawsz; 103 103 }
+4 -2
resolve-undo.h
··· 14 14 }; 15 15 16 16 void record_resolve_undo(struct index_state *, struct cache_entry *); 17 - void resolve_undo_write(struct strbuf *, struct string_list *); 18 - struct string_list *resolve_undo_read(const char *, unsigned long); 17 + void resolve_undo_write(struct strbuf *, struct string_list *, 18 + const struct git_hash_algo *algop); 19 + struct string_list *resolve_undo_read(const char *, unsigned long, 20 + const struct git_hash_algo *algop); 19 21 void resolve_undo_clear_index(struct index_state *); 20 22 int unmerge_index_entry(struct index_state *, const char *, struct resolve_undo_info *, unsigned); 21 23 void unmerge_index(struct index_state *, const struct pathspec *, unsigned);
+40 -37
send-pack.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 - 3 1 #include "git-compat-util.h" 4 2 #include "config.h" 5 3 #include "commit.h" ··· 44 42 die("bad %s argument: %s", opt->long_name, arg); 45 43 } 46 44 47 - static void feed_object(const struct object_id *oid, FILE *fh, int negative) 45 + static void feed_object(struct repository *r, 46 + const struct object_id *oid, FILE *fh, int negative) 48 47 { 49 48 if (negative && 50 - !repo_has_object_file_with_flags(the_repository, oid, 49 + !repo_has_object_file_with_flags(r, oid, 51 50 OBJECT_INFO_SKIP_FETCH_OBJECT | 52 51 OBJECT_INFO_QUICK)) 53 52 return; ··· 61 60 /* 62 61 * Make a pack stream and spit it out into file descriptor fd 63 62 */ 64 - static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised, 63 + static int pack_objects(struct repository *r, 64 + int fd, struct ref *refs, struct oid_array *advertised, 65 65 struct oid_array *negotiated, 66 66 struct send_pack_args *args) 67 67 { ··· 74 74 FILE *po_in; 75 75 int rc; 76 76 77 - trace2_region_enter("send_pack", "pack_objects", the_repository); 77 + trace2_region_enter("send_pack", "pack_objects", r); 78 78 strvec_push(&po.args, "pack-objects"); 79 79 strvec_push(&po.args, "--all-progress-implied"); 80 80 strvec_push(&po.args, "--revs"); ··· 87 87 strvec_push(&po.args, "-q"); 88 88 if (args->progress) 89 89 strvec_push(&po.args, "--progress"); 90 - if (is_repository_shallow(the_repository)) 90 + if (is_repository_shallow(r)) 91 91 strvec_push(&po.args, "--shallow"); 92 92 if (args->disable_bitmaps) 93 93 strvec_push(&po.args, "--no-use-bitmap-index"); ··· 104 104 */ 105 105 po_in = xfdopen(po.in, "w"); 106 106 for (size_t i = 0; i < advertised->nr; i++) 107 - feed_object(&advertised->oid[i], po_in, 1); 107 + feed_object(r, &advertised->oid[i], po_in, 1); 108 108 for (size_t i = 0; i < negotiated->nr; i++) 109 - feed_object(&negotiated->oid[i], po_in, 1); 109 + feed_object(r, &negotiated->oid[i], po_in, 1); 110 110 111 111 while (refs) { 112 112 if (!is_null_oid(&refs->old_oid)) 113 - feed_object(&refs->old_oid, po_in, 1); 113 + feed_object(r, &refs->old_oid, po_in, 1); 114 114 if (!is_null_oid(&refs->new_oid)) 115 - feed_object(&refs->new_oid, po_in, 0); 115 + feed_object(r, &refs->new_oid, po_in, 0); 116 116 refs = refs->next; 117 117 } 118 118 ··· 146 146 */ 147 147 if (rc > 128 && rc != 141) 148 148 error("pack-objects died of signal %d", rc - 128); 149 - trace2_region_leave("send_pack", "pack_objects", the_repository); 149 + trace2_region_leave("send_pack", "pack_objects", r); 150 150 return -1; 151 151 } 152 - trace2_region_leave("send_pack", "pack_objects", the_repository); 152 + trace2_region_leave("send_pack", "pack_objects", r); 153 153 return 0; 154 154 } 155 155 ··· 164 164 return 0; 165 165 } 166 166 167 - static int receive_status(struct packet_reader *reader, struct ref *refs) 167 + static int receive_status(struct repository *r, 168 + struct packet_reader *reader, struct ref *refs) 168 169 { 169 170 struct ref *hint; 170 171 int ret; ··· 172 173 int new_report = 0; 173 174 int once = 0; 174 175 175 - trace2_region_enter("send_pack", "receive_status", the_repository); 176 + trace2_region_enter("send_pack", "receive_status", r); 176 177 hint = NULL; 177 178 ret = receive_unpack_status(reader); 178 179 while (1) { ··· 221 222 if (!strcmp(key, "refname")) 222 223 report->ref_name = xstrdup_or_null(val); 223 224 else if (!strcmp(key, "old-oid") && val && 224 - !parse_oid_hex(val, &old_oid, &val)) 225 + !parse_oid_hex_algop(val, &old_oid, &val, r->hash_algo)) 225 226 report->old_oid = oiddup(&old_oid); 226 227 else if (!strcmp(key, "new-oid") && val && 227 - !parse_oid_hex(val, &new_oid, &val)) 228 + !parse_oid_hex_algop(val, &new_oid, &val, r->hash_algo)) 228 229 report->new_oid = oiddup(&new_oid); 229 230 else if (!strcmp(key, "forced-update")) 230 231 report->forced_update = 1; ··· 271 272 new_report = 1; 272 273 } 273 274 } 274 - trace2_region_leave("send_pack", "receive_status", the_repository); 275 + trace2_region_leave("send_pack", "receive_status", r); 275 276 return ret; 276 277 } 277 278 ··· 293 294 return 0; 294 295 } 295 296 296 - static void advertise_shallow_grafts_buf(struct strbuf *sb) 297 + static void advertise_shallow_grafts_buf(struct repository *r, struct strbuf *sb) 297 298 { 298 - if (!is_repository_shallow(the_repository)) 299 + if (!is_repository_shallow(r)) 299 300 return; 300 301 for_each_commit_graft(advertise_shallow_grafts_cb, sb); 301 302 } ··· 426 427 } 427 428 } 428 429 429 - static void get_commons_through_negotiation(const char *url, 430 + static void get_commons_through_negotiation(struct repository *r, 431 + const char *url, 430 432 const struct ref *remote_refs, 431 433 struct oid_array *commons) 432 434 { 433 435 struct child_process child = CHILD_PROCESS_INIT; 434 436 const struct ref *ref; 435 - int len = the_hash_algo->hexsz + 1; /* hash + NL */ 437 + int len = r->hash_algo->hexsz + 1; /* hash + NL */ 436 438 int nr_negotiation_tip = 0; 437 439 438 440 child.git_cmd = 1; ··· 466 468 break; 467 469 if (read_len != len) 468 470 die("invalid length read %d", read_len); 469 - if (parse_oid_hex(hex_hash, &oid, &end) || *end != '\n') 471 + if (parse_oid_hex_algop(hex_hash, &oid, &end, r->hash_algo) || *end != '\n') 470 472 die("invalid hash"); 471 473 oid_array_append(commons, &oid); 472 474 } while (1); ··· 480 482 } 481 483 } 482 484 483 - int send_pack(struct send_pack_args *args, 485 + int send_pack(struct repository *r, 486 + struct send_pack_args *args, 484 487 int fd[], struct child_process *conn, 485 488 struct ref *remote_refs, 486 489 struct oid_array *extra_have) ··· 518 521 goto out; 519 522 } 520 523 521 - git_config_get_bool("push.negotiate", &push_negotiate); 524 + repo_config_get_bool(r, "push.negotiate", &push_negotiate); 522 525 if (push_negotiate) { 523 - trace2_region_enter("send_pack", "push_negotiate", the_repository); 524 - get_commons_through_negotiation(args->url, remote_refs, &commons); 525 - trace2_region_leave("send_pack", "push_negotiate", the_repository); 526 + trace2_region_enter("send_pack", "push_negotiate", r); 527 + get_commons_through_negotiation(r, args->url, remote_refs, &commons); 528 + trace2_region_leave("send_pack", "push_negotiate", r); 526 529 } 527 530 528 - if (!git_config_get_bool("push.usebitmaps", &use_bitmaps)) 531 + if (!repo_config_get_bool(r, "push.usebitmaps", &use_bitmaps)) 529 532 args->disable_bitmaps = !use_bitmaps; 530 533 531 - git_config_get_bool("transfer.advertisesid", &advertise_sid); 534 + repo_config_get_bool(r, "transfer.advertisesid", &advertise_sid); 532 535 533 536 /* Does the other end support the reporting? */ 534 537 if (server_supports("report-status-v2")) ··· 554 557 if (server_supports("push-options")) 555 558 push_options_supported = 1; 556 559 557 - if (!server_supports_hash(the_hash_algo->name, &object_format_supported)) 560 + if (!server_supports_hash(r->hash_algo->name, &object_format_supported)) 558 561 die(_("the receiving end does not support this repository's hash algorithm")); 559 562 560 563 if (args->push_cert != SEND_PACK_PUSH_CERT_NEVER) { ··· 596 599 if (use_push_options) 597 600 strbuf_addstr(&cap_buf, " push-options"); 598 601 if (object_format_supported) 599 - strbuf_addf(&cap_buf, " object-format=%s", the_hash_algo->name); 602 + strbuf_addf(&cap_buf, " object-format=%s", r->hash_algo->name); 600 603 if (agent_supported) 601 604 strbuf_addf(&cap_buf, " agent=%s", git_user_agent_sanitized()); 602 605 if (advertise_sid) ··· 646 649 } 647 650 648 651 if (!args->dry_run) 649 - advertise_shallow_grafts_buf(&req_buf); 652 + advertise_shallow_grafts_buf(r, &req_buf); 650 653 651 654 /* 652 655 * Finally, tell the other end! ··· 686 689 } 687 690 688 691 if (args->stateless_rpc) { 689 - if (!args->dry_run && (cmds_sent || is_repository_shallow(the_repository))) { 692 + if (!args->dry_run && (cmds_sent || is_repository_shallow(r))) { 690 693 packet_buf_flush(&req_buf); 691 694 send_sideband(out, -1, req_buf.buf, req_buf.len, LARGE_PACKET_MAX); 692 695 } ··· 711 714 PACKET_READ_DIE_ON_ERR_PACKET); 712 715 713 716 if (need_pack_data && cmds_sent) { 714 - if (pack_objects(out, remote_refs, extra_have, &commons, args) < 0) { 717 + if (pack_objects(r, out, remote_refs, extra_have, &commons, args) < 0) { 715 718 if (args->stateless_rpc) 716 719 close(out); 717 720 if (git_connection_is_socket(conn)) ··· 724 727 * we get one). 725 728 */ 726 729 if (status_report) 727 - receive_status(&reader, remote_refs); 730 + receive_status(r, &reader, remote_refs); 728 731 729 732 if (use_sideband) { 730 733 close(demux.out); ··· 743 746 packet_flush(out); 744 747 745 748 if (status_report && cmds_sent) 746 - ret = receive_status(&reader, remote_refs); 749 + ret = receive_status(r, &reader, remote_refs); 747 750 else 748 751 ret = 0; 749 752 if (args->stateless_rpc)
+2 -1
send-pack.h
··· 6 6 struct child_process; 7 7 struct oid_array; 8 8 struct ref; 9 + struct repository; 9 10 10 11 /* Possible values for push_cert field in send_pack_args. */ 11 12 #define SEND_PACK_PUSH_CERT_NEVER 0 ··· 35 36 int option_parse_push_signed(const struct option *opt, 36 37 const char *arg, int unset); 37 38 38 - int send_pack(struct send_pack_args *args, 39 + int send_pack(struct repository *r, struct send_pack_args *args, 39 40 int fd[], struct child_process *conn, 40 41 struct ref *remote_refs, struct oid_array *extra_have); 41 42
+17 -19
serve.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 - 3 1 #include "git-compat-util.h" 4 2 #include "repository.h" 5 3 #include "config.h" ··· 159 157 }, 160 158 }; 161 159 162 - void protocol_v2_advertise_capabilities(void) 160 + void protocol_v2_advertise_capabilities(struct repository *r) 163 161 { 164 162 struct strbuf capability = STRBUF_INIT; 165 163 struct strbuf value = STRBUF_INIT; ··· 170 168 for (size_t i = 0; i < ARRAY_SIZE(capabilities); i++) { 171 169 struct protocol_capability *c = &capabilities[i]; 172 170 173 - if (c->advertise(the_repository, &value)) { 171 + if (c->advertise(r, &value)) { 174 172 strbuf_addstr(&capability, c->name); 175 173 176 174 if (value.len) { ··· 214 212 return NULL; 215 213 } 216 214 217 - static int receive_client_capability(const char *key) 215 + static int receive_client_capability(struct repository *r, const char *key) 218 216 { 219 217 const char *value; 220 218 const struct protocol_capability *c = get_capability(key, &value); 221 219 222 - if (!c || c->command || !c->advertise(the_repository, NULL)) 220 + if (!c || c->command || !c->advertise(r, NULL)) 223 221 return 0; 224 222 225 223 if (c->receive) 226 - c->receive(the_repository, value); 224 + c->receive(r, value); 227 225 return 1; 228 226 } 229 227 230 - static int parse_command(const char *key, struct protocol_capability **command) 228 + static int parse_command(struct repository *r, const char *key, struct protocol_capability **command) 231 229 { 232 230 const char *out; 233 231 ··· 238 236 if (*command) 239 237 die("command '%s' requested after already requesting command '%s'", 240 238 out, (*command)->name); 241 - if (!cmd || !cmd->advertise(the_repository, NULL) || !cmd->command || value) 239 + if (!cmd || !cmd->advertise(r, NULL) || !cmd->command || value) 242 240 die("invalid command '%s'", out); 243 241 244 242 *command = cmd; ··· 253 251 PROCESS_REQUEST_DONE, 254 252 }; 255 253 256 - static int process_request(void) 254 + static int process_request(struct repository *r) 257 255 { 258 256 enum request_state state = PROCESS_REQUEST_KEYS; 259 257 struct packet_reader reader; ··· 278 276 case PACKET_READ_EOF: 279 277 BUG("Should have already died when seeing EOF"); 280 278 case PACKET_READ_NORMAL: 281 - if (parse_command(reader.line, &command) || 282 - receive_client_capability(reader.line)) 279 + if (parse_command(r, reader.line, &command) || 280 + receive_client_capability(r, reader.line)) 283 281 seen_capability_or_command = 1; 284 282 else 285 283 die("unknown capability '%s'", reader.line); ··· 319 317 if (!command) 320 318 die("no command requested"); 321 319 322 - if (client_hash_algo != hash_algo_by_ptr(the_repository->hash_algo)) 320 + if (client_hash_algo != hash_algo_by_ptr(r->hash_algo)) 323 321 die("mismatched object format: server %s; client %s", 324 - the_repository->hash_algo->name, 322 + r->hash_algo->name, 325 323 hash_algos[client_hash_algo].name); 326 324 327 - command->command(the_repository, &reader); 325 + command->command(r, &reader); 328 326 329 327 return 0; 330 328 } 331 329 332 - void protocol_v2_serve_loop(int stateless_rpc) 330 + void protocol_v2_serve_loop(struct repository *r, int stateless_rpc) 333 331 { 334 332 if (!stateless_rpc) 335 - protocol_v2_advertise_capabilities(); 333 + protocol_v2_advertise_capabilities(r); 336 334 337 335 /* 338 336 * If stateless-rpc was requested then exit after 339 337 * a single request/response exchange 340 338 */ 341 339 if (stateless_rpc) { 342 - process_request(); 340 + process_request(r); 343 341 } else { 344 342 for (;;) 345 - if (process_request()) 343 + if (process_request(r)) 346 344 break; 347 345 } 348 346 }
+4 -2
serve.h
··· 1 1 #ifndef SERVE_H 2 2 #define SERVE_H 3 3 4 - void protocol_v2_advertise_capabilities(void); 5 - void protocol_v2_serve_loop(int stateless_rpc); 4 + struct repository; 5 + 6 + void protocol_v2_advertise_capabilities(struct repository *r); 7 + void protocol_v2_serve_loop(struct repository *r, int stateless_rpc); 6 8 7 9 #endif /* SERVE_H */
+22 -18
server-info.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 1 #define DISABLE_SIGN_COMPARE_WARNINGS 3 2 4 3 #include "git-compat-util.h" ··· 18 17 #include "tempfile.h" 19 18 20 19 struct update_info_ctx { 20 + struct repository *repo; 21 21 FILE *cur_fp; 22 22 FILE *old_fp; /* becomes NULL if it differs from cur_fp */ 23 23 struct strbuf cur_sb; ··· 73 73 * it into place. The contents of the file come from "generate", which 74 74 * should return non-zero if it encounters an error. 75 75 */ 76 - static int update_info_file(char *path, 76 + static int update_info_file(struct repository *r, char *path, 77 77 int (*generate)(struct update_info_ctx *), 78 78 int force) 79 79 { ··· 81 81 struct tempfile *f = NULL; 82 82 int ret = -1; 83 83 struct update_info_ctx uic = { 84 + .repo = r, 84 85 .cur_fp = NULL, 85 86 .old_fp = NULL, 86 87 .cur_sb = STRBUF_INIT, ··· 152 153 void *cb_data) 153 154 { 154 155 struct update_info_ctx *uic = cb_data; 155 - struct object *o = parse_object(the_repository, oid); 156 + struct object *o = parse_object(uic->repo, oid); 156 157 if (!o) 157 158 return -1; 158 159 ··· 160 161 return -1; 161 162 162 163 if (o->type == OBJ_TAG) { 163 - o = deref_tag(the_repository, o, path, 0); 164 + o = deref_tag(uic->repo, o, path, 0); 164 165 if (o) 165 166 if (uic_printf(uic, "%s %s^{}\n", 166 167 oid_to_hex(&o->oid), path) < 0) ··· 171 172 172 173 static int generate_info_refs(struct update_info_ctx *uic) 173 174 { 174 - return refs_for_each_ref(get_main_ref_store(the_repository), 175 + return refs_for_each_ref(get_main_ref_store(uic->repo), 175 176 add_info_ref, uic); 176 177 } 177 178 178 - static int update_info_refs(int force) 179 + static int update_info_refs(struct repository *r, int force) 179 180 { 180 - char *path = git_pathdup("info/refs"); 181 - int ret = update_info_file(path, generate_info_refs, force); 181 + char *path = repo_git_path(r, "info/refs"); 182 + int ret = update_info_file(r, path, generate_info_refs, force); 182 183 free(path); 183 184 return ret; 184 185 } ··· 284 285 return 1; 285 286 } 286 287 287 - static void init_pack_info(const char *infofile, int force) 288 + static void init_pack_info(struct repository *r, const char *infofile, int force) 288 289 { 289 290 struct packed_git *p; 290 291 int stale; 291 292 int i; 292 293 size_t alloc = 0; 293 294 294 - for (p = get_all_packs(the_repository); p; p = p->next) { 295 + for (p = get_all_packs(r); p; p = p->next) { 295 296 /* we ignore things on alternate path since they are 296 297 * not available to the pullers in general. 297 298 */ ··· 340 341 return 0; 341 342 } 342 343 343 - static int update_info_packs(int force) 344 + static int update_info_packs(struct repository *r, int force) 344 345 { 345 346 char *infofile = mkpathdup("%s/info/packs", 346 - repo_get_object_directory(the_repository)); 347 + repo_get_object_directory(r)); 347 348 int ret; 348 349 349 - init_pack_info(infofile, force); 350 - ret = update_info_file(infofile, write_pack_info_file, force); 350 + init_pack_info(r, infofile, force); 351 + ret = update_info_file(r, infofile, write_pack_info_file, force); 351 352 free_pack_info(); 352 353 free(infofile); 353 354 return ret; 354 355 } 355 356 356 357 /* public */ 357 - int update_server_info(int force) 358 + int update_server_info(struct repository *r, int force) 358 359 { 359 360 /* We would add more dumb-server support files later, 360 361 * including index of available pack files and their 361 362 * intended audiences. 362 363 */ 363 364 int errs = 0; 365 + char *path; 364 366 365 - errs = errs | update_info_refs(force); 366 - errs = errs | update_info_packs(force); 367 + errs = errs | update_info_refs(r, force); 368 + errs = errs | update_info_packs(r, force); 367 369 368 370 /* remove leftover rev-cache file if there is any */ 369 - unlink_or_warn(git_path("info/rev-cache")); 371 + path = repo_git_path(r, "info/rev-cache"); 372 + unlink_or_warn(path); 373 + free(path); 370 374 371 375 return errs; 372 376 }
+3 -1
server-info.h
··· 1 1 #ifndef SERVER_INFO_H 2 2 #define SERVER_INFO_H 3 3 4 + struct repository; 5 + 4 6 /* Dumb servers support */ 5 - int update_server_info(int); 7 + int update_server_info(struct repository *r, int force); 6 8 7 9 #endif /* SERVER_INFO_H */
+5 -1
t/helper/test-progress.c
··· 17 17 * 18 18 * See 't0500-progress-display.sh' for examples. 19 19 */ 20 + 21 + #define USE_THE_REPOSITORY_VARIABLE 20 22 #define GIT_TEST_PROGRESS_ONLY 23 + 21 24 #include "test-tool.h" 22 25 #include "parse-options.h" 23 26 #include "progress.h" 27 + #include "repository.h" 24 28 #include "strbuf.h" 25 29 #include "string-list.h" 26 30 ··· 64 68 else 65 69 die("invalid input: '%s'", line.buf); 66 70 67 - progress = start_progress(title, total); 71 + progress = start_progress(the_repository, title, total); 68 72 } else if (skip_prefix(line.buf, "progress ", (const char **) &end)) { 69 73 uint64_t item_count = strtoull(end, &end, 10); 70 74 if (*end != '\0')
+5 -2
t/helper/test-serve-v2.c
··· 1 + #define USE_THE_REPOSITORY_VARIABLE 2 + 1 3 #include "test-tool.h" 2 4 #include "gettext.h" 3 5 #include "parse-options.h" 6 + #include "repository.h" 4 7 #include "serve.h" 5 8 #include "setup.h" 6 9 ··· 28 31 PARSE_OPT_KEEP_UNKNOWN_OPT); 29 32 30 33 if (advertise_capabilities) 31 - protocol_v2_advertise_capabilities(); 34 + protocol_v2_advertise_capabilities(the_repository); 32 35 else 33 - protocol_v2_serve_loop(stateless_rpc); 36 + protocol_v2_serve_loop(the_repository, stateless_rpc); 34 37 35 38 return 0; 36 39 }
+8 -7
tmp-objdir.c
··· 1 - #define USE_THE_REPOSITORY_VARIABLE 2 - 3 1 #include "git-compat-util.h" 4 2 #include "tmp-objdir.h" 5 3 #include "abspath.h" ··· 16 14 #include "repository.h" 17 15 18 16 struct tmp_objdir { 17 + struct repository *repo; 19 18 struct strbuf path; 20 19 struct strvec env; 21 20 struct object_directory *prev_odb; ··· 116 115 return ret; 117 116 } 118 117 119 - struct tmp_objdir *tmp_objdir_create(const char *prefix) 118 + struct tmp_objdir *tmp_objdir_create(struct repository *r, 119 + const char *prefix) 120 120 { 121 121 static int installed_handlers; 122 122 struct tmp_objdir *t; ··· 125 125 BUG("only one tmp_objdir can be used at a time"); 126 126 127 127 t = xcalloc(1, sizeof(*t)); 128 + t->repo = r; 128 129 strbuf_init(&t->path, 0); 129 130 strvec_init(&t->env); 130 131 ··· 134 135 * them. 135 136 */ 136 137 strbuf_addf(&t->path, "%s/tmp_objdir-%s-XXXXXX", 137 - repo_get_object_directory(the_repository), prefix); 138 + repo_get_object_directory(r), prefix); 138 139 139 140 if (!mkdtemp(t->path.buf)) { 140 141 /* free, not destroy, as we never touched the filesystem */ ··· 154 155 } 155 156 156 157 env_append(&t->env, ALTERNATE_DB_ENVIRONMENT, 157 - absolute_path(repo_get_object_directory(the_repository))); 158 + absolute_path(repo_get_object_directory(r))); 158 159 env_replace(&t->env, DB_ENVIRONMENT, absolute_path(t->path.buf)); 159 160 env_replace(&t->env, GIT_QUARANTINE_ENVIRONMENT, 160 161 absolute_path(t->path.buf)); ··· 273 274 return 0; 274 275 275 276 if (t->prev_odb) { 276 - if (the_repository->objects->odb->will_destroy) 277 + if (t->repo->objects->odb->will_destroy) 277 278 BUG("migrating an ODB that was marked for destruction"); 278 279 restore_primary_odb(t->prev_odb, t->path.buf); 279 280 t->prev_odb = NULL; 280 281 } 281 282 282 283 strbuf_addbuf(&src, &t->path); 283 - strbuf_addstr(&dst, repo_get_object_directory(the_repository)); 284 + strbuf_addstr(&dst, repo_get_object_directory(t->repo)); 284 285 285 286 ret = migrate_paths(&src, &dst, 0); 286 287
+3 -2
tmp-objdir.h
··· 11 11 * Example: 12 12 * 13 13 * struct child_process child = CHILD_PROCESS_INIT; 14 - * struct tmp_objdir *t = tmp_objdir_create("incoming"); 14 + * struct tmp_objdir *t = tmp_objdir_create(repo, "incoming"); 15 15 * strvec_push(&child.args, cmd); 16 16 * strvec_pushv(&child.env, tmp_objdir_env(t)); 17 17 * if (!run_command(&child)) && !tmp_objdir_migrate(t)) ··· 21 21 * 22 22 */ 23 23 24 + struct repository; 24 25 struct tmp_objdir; 25 26 26 27 /* 27 28 * Create a new temporary object directory with the specified prefix; 28 29 * returns NULL on failure. 29 30 */ 30 - struct tmp_objdir *tmp_objdir_create(const char *prefix); 31 + struct tmp_objdir *tmp_objdir_create(struct repository *r, const char *prefix); 31 32 32 33 /* 33 34 * Return a list of environment strings, suitable for use with
+4 -5
trace.c
··· 21 21 * along with this program; if not, see <https://www.gnu.org/licenses/>. 22 22 */ 23 23 24 - #define USE_THE_REPOSITORY_VARIABLE 25 24 #define DISABLE_SIGN_COMPARE_WARNINGS 26 25 27 26 #include "git-compat-util.h" ··· 298 297 return new_path.buf; 299 298 } 300 299 301 - void trace_repo_setup(void) 300 + void trace_repo_setup(struct repository *r) 302 301 { 303 302 const char *git_work_tree, *prefix = startup_info->prefix; 304 303 char *cwd; ··· 308 307 309 308 cwd = xgetcwd(); 310 309 311 - if (!(git_work_tree = repo_get_work_tree(the_repository))) 310 + if (!(git_work_tree = repo_get_work_tree(r))) 312 311 git_work_tree = "(null)"; 313 312 314 313 if (!startup_info->prefix) 315 314 prefix = "(null)"; 316 315 317 - trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(repo_get_git_dir(the_repository))); 318 - trace_printf_key(&trace_setup_key, "setup: git_common_dir: %s\n", quote_crnl(repo_get_common_dir(the_repository))); 316 + trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(repo_get_git_dir(r))); 317 + trace_printf_key(&trace_setup_key, "setup: git_common_dir: %s\n", quote_crnl(repo_get_common_dir(r))); 319 318 trace_printf_key(&trace_setup_key, "setup: worktree: %s\n", quote_crnl(git_work_tree)); 320 319 trace_printf_key(&trace_setup_key, "setup: cwd: %s\n", quote_crnl(cwd)); 321 320 trace_printf_key(&trace_setup_key, "setup: prefix: %s\n", quote_crnl(prefix));
+3 -1
trace.h
··· 92 92 extern struct trace_key trace_perf_key; 93 93 extern struct trace_key trace_setup_key; 94 94 95 - void trace_repo_setup(void); 95 + struct repository; 96 + 97 + void trace_repo_setup(struct repository *r); 96 98 97 99 /** 98 100 * Checks whether the trace key is enabled. Used to prevent expensive
+1 -1
transport.c
··· 932 932 break; 933 933 case protocol_v1: 934 934 case protocol_v0: 935 - ret = send_pack(&args, data->fd, data->conn, remote_refs, 935 + ret = send_pack(the_repository, &args, data->fd, data->conn, remote_refs, 936 936 &data->extra_have); 937 937 break; 938 938 case protocol_unknown_version:
+3 -1
unpack-trees.c
··· 372 372 total++; 373 373 } 374 374 375 - return start_delayed_progress(_("Updating files"), total); 375 + return start_delayed_progress(the_repository, 376 + _("Updating files"), total); 376 377 } 377 378 378 379 static void setup_collided_checkout_detection(struct checkout *state, ··· 1773 1774 strbuf_reset(&prefix); 1774 1775 if (show_progress) 1775 1776 istate->progress = start_delayed_progress( 1777 + the_repository, 1776 1778 _("Updating index flags"), 1777 1779 istate->cache_nr); 1778 1780
+2 -1
walker.c
··· 172 172 uint64_t nr = 0; 173 173 174 174 if (walker->get_progress) 175 - progress = start_delayed_progress(_("Fetching objects"), 0); 175 + progress = start_delayed_progress(the_repository, 176 + _("Fetching objects"), 0); 176 177 177 178 while (process_queue) { 178 179 struct object *obj = process_queue->item;