aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-01-21 08:44:54 -0800
committerJunio C Hamano <gitster@pobox.com>2025-01-21 08:44:54 -0800
commit7b39a128c814a2362d0533c7df0ab7a2fef6fa4b (patch)
tree6f348b269516bb30655e03ef6a637609d007c5d2 /builtin
parentd6a7cace21e689dbbc6a4135d21a1ff6bdc04ce7 (diff)
parentd4cd757051d1c779f1d95557b7ac523a6e1803fc (diff)
downloadgit-7b39a128c814a2362d0533c7df0ab7a2fef6fa4b.tar.gz
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`
Diffstat (limited to 'builtin')
-rw-r--r--builtin/am.c6
-rw-r--r--builtin/blame.c6
-rw-r--r--builtin/bugreport.c2
-rw-r--r--builtin/commit-graph.c1
-rw-r--r--builtin/credential.c6
-rw-r--r--builtin/diagnose.c4
-rw-r--r--builtin/fsck.c12
-rw-r--r--builtin/grep.c4
-rw-r--r--builtin/help.c4
-rw-r--r--builtin/index-pack.c7
-rw-r--r--builtin/log.c7
-rw-r--r--builtin/mailinfo.c2
-rw-r--r--builtin/pack-objects.c21
-rw-r--r--builtin/prune.c3
-rw-r--r--builtin/receive-pack.c4
-rw-r--r--builtin/remote.c3
-rw-r--r--builtin/repack.c2
-rw-r--r--builtin/rev-list.c3
-rw-r--r--builtin/send-pack.c2
-rw-r--r--builtin/unpack-objects.c3
-rw-r--r--builtin/update-server-info.c2
-rw-r--r--builtin/upload-pack.c6
-rw-r--r--builtin/var.c2
23 files changed, 69 insertions, 43 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 1338b606fe..e94d08e04b 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1211,7 +1211,7 @@ static int parse_mail(struct am_state *state, const char *mail)
int ret = 0;
struct mailinfo mi;
- setup_mailinfo(&mi);
+ setup_mailinfo(the_repository, &mi);
if (state->utf8)
mi.metainfo_charset = get_commit_output_encoding();
@@ -1786,7 +1786,7 @@ static int do_interactive(struct am_state *state)
}
strbuf_release(&msg);
} else if (*reply == 'v' || *reply == 'V') {
- const char *pager = git_pager(1);
+ const char *pager = git_pager(the_repository, 1);
struct child_process cp = CHILD_PROCESS_INIT;
if (!pager)
@@ -2246,7 +2246,7 @@ static int show_patch(struct am_state *state, enum resume_type resume_mode)
if (len < 0)
die_errno(_("failed to read '%s'"), patch_path);
- setup_pager();
+ setup_pager(the_repository);
write_in_full(1, sb.buf, sb.len);
strbuf_release(&sb);
return 0;
diff --git a/builtin/blame.c b/builtin/blame.c
index 7555c445ab..c470654c7e 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1194,14 +1194,16 @@ parse_done:
sb.found_guilty_entry = &found_guilty_entry;
sb.found_guilty_entry_data = &pi;
if (show_progress)
- pi.progress = start_delayed_progress(_("Blaming lines"), num_lines);
+ pi.progress = start_delayed_progress(the_repository,
+ _("Blaming lines"),
+ num_lines);
assign_blame(&sb, opt);
stop_progress(&pi.progress);
if (!incremental)
- setup_pager();
+ setup_pager(the_repository);
else
goto cleanup;
diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 7c2df035c9..0ac59cc8dc 100644
--- a/builtin/bugreport.c
+++ b/builtin/bugreport.c
@@ -167,7 +167,7 @@ int cmd_bugreport(int argc,
strbuf_addftime(&zip_path, option_suffix, localtime_r(&now, &tm), 0, 0);
strbuf_addstr(&zip_path, ".zip");
- if (create_diagnostics_archive(&zip_path, diagnose))
+ if (create_diagnostics_archive(the_repository, &zip_path, diagnose))
die_errno(_("unable to create diagnostics archive %s"), zip_path.buf);
strbuf_release(&zip_path);
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index bd70d052e7..8ca75262c5 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -305,6 +305,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
oidset_init(&commits, 0);
if (opts.progress)
progress = start_delayed_progress(
+ the_repository,
_("Collecting commits from input"), 0);
while (strbuf_getline(&buf, stdin) != EOF) {
diff --git a/builtin/credential.c b/builtin/credential.c
index 14c8c6608b..614b195b75 100644
--- a/builtin/credential.c
+++ b/builtin/credential.c
@@ -32,15 +32,15 @@ int cmd_credential(int argc,
die("unable to read credential from stdin");
if (!strcmp(op, "fill")) {
- credential_fill(&c, 0);
+ credential_fill(the_repository, &c, 0);
credential_next_state(&c);
credential_write(&c, stdout, CREDENTIAL_OP_RESPONSE);
} else if (!strcmp(op, "approve")) {
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
- credential_approve(&c);
+ credential_approve(the_repository, &c);
} else if (!strcmp(op, "reject")) {
credential_set_all_capabilities(&c, CREDENTIAL_OP_HELPER);
- credential_reject(&c);
+ credential_reject(the_repository, &c);
} else {
usage(usage_msg);
}
diff --git a/builtin/diagnose.c b/builtin/diagnose.c
index 66a22d918e..33c39bd598 100644
--- a/builtin/diagnose.c
+++ b/builtin/diagnose.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
#include "builtin.h"
#include "abspath.h"
#include "gettext.h"
@@ -58,7 +60,7 @@ int cmd_diagnose(int argc,
}
/* Prepare diagnostics */
- if (create_diagnostics_archive(&zip_path, mode))
+ if (create_diagnostics_archive(the_repository, &zip_path, mode))
die_errno(_("unable to create diagnostics archive %s"),
zip_path.buf);
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 0196c54eb6..7a4dcb0716 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -197,7 +197,8 @@ static int traverse_reachable(void)
unsigned int nr = 0;
int result = 0;
if (show_progress)
- progress = start_delayed_progress(_("Checking connectivity"), 0);
+ progress = start_delayed_progress(the_repository,
+ _("Checking connectivity"), 0);
while (pending.nr) {
result |= traverse_one_object(object_array_pop(&pending));
display_progress(progress, ++nr);
@@ -703,7 +704,8 @@ static void fsck_object_dir(const char *path)
fprintf_ln(stderr, _("Checking object directory"));
if (show_progress)
- progress = start_progress(_("Checking object directories"), 256);
+ progress = start_progress(the_repository,
+ _("Checking object directories"), 256);
for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir,
&cb_data);
@@ -879,7 +881,8 @@ static int check_pack_rev_indexes(struct repository *r, int show_progress)
if (show_progress) {
for (struct packed_git *p = get_all_packs(r); p; p = p->next)
pack_count++;
- progress = start_delayed_progress("Verifying reverse pack-indexes", pack_count);
+ progress = start_delayed_progress(the_repository,
+ "Verifying reverse pack-indexes", pack_count);
pack_count = 0;
}
@@ -989,7 +992,8 @@ int cmd_fsck(int argc,
total += p->num_objects;
}
- progress = start_progress(_("Checking objects"), total);
+ progress = start_progress(the_repository,
+ _("Checking objects"), total);
}
for (p = get_all_packs(the_repository); p;
p = p->next) {
diff --git a/builtin/grep.c b/builtin/grep.c
index d00ee76f24..d1427290f7 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1084,7 +1084,7 @@ int cmd_grep(int argc,
}
if (show_in_pager == default_pager)
- show_in_pager = git_pager(1);
+ show_in_pager = git_pager(the_repository, 1);
if (show_in_pager) {
opt.color = 0;
opt.name_only = 1;
@@ -1246,7 +1246,7 @@ int cmd_grep(int argc,
}
if (!show_in_pager && !opt.status_only)
- setup_pager();
+ setup_pager(the_repository);
die_for_incompatible_opt3(!use_index, "--no-index",
untracked, "--untracked",
diff --git a/builtin/help.c b/builtin/help.c
index 05136279cf..c257079ceb 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -658,7 +658,7 @@ int cmd_help(int argc,
case HELP_ACTION_ALL:
opt_mode_usage(argc, "--all", help_format);
if (verbose) {
- setup_pager();
+ setup_pager(the_repository);
list_all_cmds_help(show_external_commands,
show_aliases);
return 0;
@@ -692,7 +692,7 @@ int cmd_help(int argc,
return 0;
case HELP_ACTION_CONFIG:
opt_mode_usage(argc, "--config", help_format);
- setup_pager();
+ setup_pager(the_repository);
list_config_help(SHOW_CONFIG_HUMAN);
printf("\n%s\n", _("'git help config' for more information"));
return 0;
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 0b62b2589f..0bef61c572 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -282,7 +282,8 @@ static unsigned check_objects(void)
max = get_max_object_index();
if (verbose)
- progress = start_delayed_progress(_("Checking objects"), max);
+ progress = start_delayed_progress(the_repository,
+ _("Checking objects"), max);
for (i = 0; i < max; i++) {
foreign_nr += check_object(get_indexed_object(i));
@@ -1249,6 +1250,7 @@ static void parse_pack_objects(unsigned char *hash)
if (verbose)
progress = start_progress(
+ the_repository,
progress_title ? progress_title :
from_stdin ? _("Receiving objects") : _("Indexing objects"),
nr_objects);
@@ -1329,7 +1331,8 @@ static void resolve_deltas(struct pack_idx_option *opts)
QSORT(ref_deltas, nr_ref_deltas, compare_ref_delta_entry);
if (verbose || show_resolving_progress)
- progress = start_progress(_("Resolving deltas"),
+ progress = start_progress(the_repository,
+ _("Resolving deltas"),
nr_ref_deltas + nr_ofs_deltas);
nr_dispatched = 0;
diff --git a/builtin/log.c b/builtin/log.c
index a4f41aafca..e41f88945e 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -367,7 +367,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
if (rev->line_level_traverse)
line_log_init(rev, line_cb.prefix, &line_cb.args);
- setup_pager();
+ setup_pager(the_repository);
}
static void cmd_log_init(int argc, const char **argv, const char *prefix,
@@ -2295,7 +2295,7 @@ int cmd_format_patch(int argc,
rev.commit_format = CMIT_FMT_MBOXRD;
if (use_stdout) {
- setup_pager();
+ setup_pager(the_repository);
} else if (!rev.diffopt.close_file) {
int saved;
@@ -2498,7 +2498,8 @@ int cmd_format_patch(int argc,
rev.add_signoff = cfg.do_signoff;
if (show_progress)
- progress = start_delayed_progress(_("Generating patches"), total);
+ progress = start_delayed_progress(the_repository,
+ _("Generating patches"), total);
for (i = 0; i < nr; i++) {
size_t idx = nr - i - 1;
int shown;
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index e17dec27b1..8de7ba7de1 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -83,7 +83,7 @@ int cmd_mailinfo(int argc,
OPT_END()
};
- setup_mailinfo(&mi);
+ setup_mailinfo(the_repository, &mi);
meta_charset.policy = CHARSET_DEFAULT;
argc = parse_options(argc, argv, prefix, options, mailinfo_usage, 0);
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 1c3b842651..d51c021d99 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1264,7 +1264,8 @@ static void write_pack_file(void)
struct object_entry **write_order;
if (progress > pack_to_stdout)
- progress_state = start_progress(_("Writing objects"), nr_result);
+ progress_state = start_progress(the_repository,
+ _("Writing objects"), nr_result);
ALLOC_ARRAY(written_list, to_pack.nr_objects);
write_order = compute_write_order();
@@ -2400,7 +2401,8 @@ static void get_object_details(void)
struct object_entry **sorted_by_offset;
if (progress)
- progress_state = start_progress(_("Counting objects"),
+ progress_state = start_progress(the_repository,
+ _("Counting objects"),
to_pack.nr_objects);
CALLOC_ARRAY(sorted_by_offset, to_pack.nr_objects);
@@ -3220,7 +3222,8 @@ static void prepare_pack(int window, int depth)
unsigned nr_done = 0;
if (progress)
- progress_state = start_progress(_("Compressing objects"),
+ progress_state = start_progress(the_repository,
+ _("Compressing objects"),
nr_deltas);
QSORT(delta_list, n, type_size_sort);
ll_find_deltas(delta_list, n, window+1, depth, &nr_done);
@@ -3648,7 +3651,8 @@ static void add_objects_in_unpacked_packs(void);
static void enumerate_cruft_objects(void)
{
if (progress)
- progress_state = start_progress(_("Enumerating cruft objects"), 0);
+ progress_state = start_progress(the_repository,
+ _("Enumerating cruft objects"), 0);
add_objects_in_unpacked_packs();
add_unreachable_loose_objects();
@@ -3674,7 +3678,8 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
revs.ignore_missing_links = 1;
if (progress)
- progress_state = start_progress(_("Enumerating cruft objects"), 0);
+ progress_state = start_progress(the_repository,
+ _("Enumerating cruft objects"), 0);
ret = add_unseen_recent_objects_to_traversal(&revs, cruft_expiration,
set_cruft_mtime, 1);
stop_progress(&progress_state);
@@ -3693,7 +3698,8 @@ static void enumerate_and_traverse_cruft_objects(struct string_list *fresh_packs
if (prepare_revision_walk(&revs))
die(_("revision walk setup failed"));
if (progress)
- progress_state = start_progress(_("Traversing cruft objects"), 0);
+ progress_state = start_progress(the_repository,
+ _("Traversing cruft objects"), 0);
nr_seen = 0;
traverse_commit_list(&revs, show_cruft_commit, show_cruft_object, NULL);
@@ -4625,7 +4631,8 @@ int cmd_pack_objects(int argc,
prepare_packing_data(the_repository, &to_pack);
if (progress && !cruft)
- progress_state = start_progress(_("Enumerating objects"), 0);
+ progress_state = start_progress(the_repository,
+ _("Enumerating objects"), 0);
if (stdin_packs) {
/* avoids adding objects in excluded packs */
ignore_packed_keep_in_core = 1;
diff --git a/builtin/prune.c b/builtin/prune.c
index aeff9ca1b3..1c357fffd8 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -64,7 +64,8 @@ static void perform_reachability_traversal(struct rev_info *revs)
return;
if (show_progress)
- progress = start_delayed_progress(_("Checking connectivity"), 0);
+ progress = start_delayed_progress(the_repository,
+ _("Checking connectivity"), 0);
mark_reachable_objects(revs, 1, expire, progress);
stop_progress(&progress);
initialized = 1;
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 0158faf537..0fb0266cfd 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -2239,7 +2239,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
strvec_push(&child.args, alt_shallow_file);
}
- tmp_objdir = tmp_objdir_create("incoming");
+ tmp_objdir = tmp_objdir_create(the_repository, "incoming");
if (!tmp_objdir) {
if (err_fd > 0)
close(err_fd);
@@ -2628,7 +2628,7 @@ int cmd_receive_pack(int argc,
}
}
if (auto_update_server_info)
- update_server_info(0);
+ update_server_info(the_repository, 0);
clear_shallow_info(&si);
}
if (use_sideband)
diff --git a/builtin/remote.c b/builtin/remote.c
index 0435963286..315cbb88e6 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -820,7 +820,8 @@ static int mv(int argc, const char **argv, const char *prefix,
* Count symrefs twice, since "renaming" them is done by
* deleting and recreating them in two separate passes.
*/
- progress = start_progress(_("Renaming remote references"),
+ progress = start_progress(the_repository,
+ _("Renaming remote references"),
rename.remote_branches->nr + rename.symrefs_nr);
}
for (i = 0; i < remote_branches.nr; i++) {
diff --git a/builtin/repack.c b/builtin/repack.c
index 0c6dad7df4..81d13630ea 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1565,7 +1565,7 @@ int cmd_repack(int argc,
}
if (run_update_server_info)
- update_server_info(0);
+ update_server_info(the_repository, 0);
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) {
unsigned flags = 0;
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 3196da7b2d..8a7db9b546 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -735,7 +735,8 @@ int cmd_rev_list(int argc,
revs.limited = 1;
if (show_progress)
- progress = start_delayed_progress(show_progress, 0);
+ progress = start_delayed_progress(the_repository,
+ show_progress, 0);
if (use_bitmap_index) {
if (!try_bitmap_count(&revs, filter_provided_objects))
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 59b626aae8..8d461008e2 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -317,7 +317,7 @@ int cmd_send_pack(int argc,
set_ref_status_for_push(remote_refs, args.send_mirror,
args.force_update);
- ret = send_pack(&args, fd, conn, remote_refs, &extra_have);
+ ret = send_pack(the_repository, &args, fd, conn, remote_refs, &extra_have);
if (helper_status)
print_helper_status(remote_refs);
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 2197d6d933..842a90353a 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -590,7 +590,8 @@ static void unpack_all(void)
use(sizeof(struct pack_header));
if (!quiet)
- progress = start_progress(_("Unpacking objects"), nr_objects);
+ progress = start_progress(the_repository,
+ _("Unpacking objects"), nr_objects);
CALLOC_ARRAY(obj_list, nr_objects);
begin_odb_transaction();
for (i = 0; i < nr_objects; i++) {
diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c
index 6769611a02..47a3f0bdd9 100644
--- a/builtin/update-server-info.c
+++ b/builtin/update-server-info.c
@@ -27,5 +27,5 @@ int cmd_update_server_info(int argc,
if (argc > 0)
usage_with_options(update_server_info_usage, options);
- return !!update_server_info(force);
+ return !!update_server_info(the_repository, force);
}
diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c
index dd63d6eadf..c2bbc035ab 100644
--- a/builtin/upload-pack.c
+++ b/builtin/upload-pack.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
#include "builtin.h"
#include "exec-cmd.h"
#include "gettext.h"
@@ -63,9 +65,9 @@ int cmd_upload_pack(int argc,
switch (determine_protocol_version_server()) {
case protocol_v2:
if (advertise_refs)
- protocol_v2_advertise_capabilities();
+ protocol_v2_advertise_capabilities(the_repository);
else
- protocol_v2_serve_loop(stateless_rpc);
+ protocol_v2_serve_loop(the_repository, stateless_rpc);
break;
case protocol_v1:
/*
diff --git a/builtin/var.c b/builtin/var.c
index 1449656cc9..50d024de66 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -42,7 +42,7 @@ static char *sequence_editor(int ident_flag UNUSED)
static char *pager(int ident_flag UNUSED)
{
- const char *pgm = git_pager(1);
+ const char *pgm = git_pager(the_repository, 1);
if (!pgm)
pgm = "cat";